You can override the machine using 1.0RC. Try this example from the SharpArchitecture bidirectional mapping from Employee to Territory, where Territory is a relationship inverse:
public class EmployeeMap : IAutoMappingOverride<Employee>
{
public void Override(AutoMap<Employee> mapping) {
mapping.HasManyToMany<Territory>(x => x.Territories)
.WithTableName("EmployeeTerritories")
.WithParentKeyColumn("EmployeeID")
.WithChildKeyColumn("TerritoryID")
.AsBag();
}
}
public class TerritoryMap : IAutoMappingOverride<Territory>
{
public void Override(AutoMap<Territory> mapping) {
mapping.HasManyToMany<Employee>(x => x.Employees)
.WithTableName("EmployeeTerritories")
.Inverse()
.WithParentKeyColumn("TerritoryID")
.WithChildKeyColumn("EmployeeID")
.AsBag();
}
}
source
share