I\'m dealing with some legacy vendor code that I can\'t modify. I\'d like to wrap the database with an abstraction layer that is easier to use.
Given the following two
It's not elegant, but I finally came up with the following:
public class Process
{
public virtual IList<Route> SourceRoutes { get; set; }
public virtual IList<Route> DestinationRoutes { get; set; }
}
public class ProcessOverride : IAutoMappingOverride<Process>
{
public void Override(AutoMapping<Process> mapping)
{
mapping.HasMany(proc => proc.SourceRoutes).Table("Routes").KeyColumn("SourceID");
mapping.HasMany(proc => proc.DestinationRoutes).Table("Routes").KeyColumn("DestID");
}
}