1.0RCを使用してオートマップを無効にすることができます。 SharpArchitectureのEmployeeからTerritoryへの双方向マッピングのこの例を試してみてください。ここで、Territoryは関係の逆です。
public class EmployeeMap : IAutoMappingOverride<Employee>
{
public void Override(AutoMap<Employee> mapping) {
//... other omitted mappings...
mapping.HasManyToMany<Territory>(x => x.Territories)
.WithTableName("EmployeeTerritories")
.WithParentKeyColumn("EmployeeID")
.WithChildKeyColumn("TerritoryID")
.AsBag();
}
}
public class TerritoryMap : IAutoMappingOverride<Territory>
{
public void Override(AutoMap<Territory> mapping) {
//... other omitted mappings...
mapping.HasManyToMany<Employee>(x => x.Employees)
.WithTableName("EmployeeTerritories")
.Inverse()
.WithParentKeyColumn("TerritoryID")
.WithChildKeyColumn("EmployeeID")
.AsBag();
}
}