I have a [User]
table/class and a [Company]
table/class and there is a link-table [UserCompany]
between them.
When editing a User, beside basic information people also could change that user's access Companies, so I do the map like this in UserMap.cs:
HasManyToMany(u => u
.Companies)
.Cascade.SaveUpdate()
.Table("UserCompany")
.ParentKeyColumn("UserId")
.ChildKeyColumn("CompanyCode")
.Not.LazyLoad();
Also in CompanyMap.cs I set inverse like this:
HasManyToMany(c => c.Users)
.Inverse()
.Table("UserCompany")
.ParentKeyColumn("CompanyCode")
.ChildKeyColumn("UserId");
The problem now is: I could update [User]
information/table, plus the linking data in [UserCompany]
table. However, the Fluent Nhibernate also update the [Company]
table which I don't need at all.
Is there any way I could let FN not update Company table?