سؤال

I have a set of tables

Users UserPermissions Permissions

A user can have a 1 or many permissions specified by the linking table UserPermissions.

My objects of type User has an IList

I'm not sure how to properly configure NHibernate so that the mapping will look at the UserPermissions key to get the Permission information.

هل كانت مفيدة؟

المحلول

standard many to many mapping?

HasManyToMany(user => user.Permissions)
    .Table("UserPermissions")
    .ParentKeyColumn("user_id")
    .ChildKeyColumn("permission_id");
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top