I am having a problem in Fluent NHibernate example utilizing the Many-to-Many relationships. I tried to find out examples on a similar case, and I found tons, but I\'m still
Regarding to code I am using in my project I would define your manyTomany relations this way:
public UsersMap()
{
...
HasManyToMany(x => x.Roles)
.WithTableName("UserInRoles")
.WithParentKeyColumn("Usernamepk")
.WithChildKeyColumn("RoleIdpk");
}
public RolesMap()
{
...
HasManyToMany(x => x.Users)
.WithTableName("UserInRoles")
.WithParentKeyColumn("RoleIdpk")
.WithChildKeyColumn("Usernamepk");
}
Such a definitions works for me. Check this first then decorate with LazyLoading and some other properties.