Nhibernate 使用代理主键创建多对多关系

Nhibernate 使用代理主键创建多对多关系,nhibernate,Nhibernate,我在我的应用程序中有多对多关系,我正在使用fluent nhibernate 登录可以有许多角色。(角色也可以有多个登录名) 我见过许多使用复合主键的示例 HasManyToMany<Role>(x => x.Roles).Table("Role") .ParentKeyColumn("RoleId") .ChildKeyColumn("LoginId"); HasManyToMany(x=>x.Roles).T

我在我的应用程序中有多对多关系,我正在使用fluent nhibernate

登录可以有许多角色。(角色也可以有多个登录名)

我见过许多使用复合主键的示例

        HasManyToMany<Role>(x => x.Roles).Table("Role")
            .ParentKeyColumn("RoleId")
            .ChildKeyColumn("LoginId");
HasManyToMany(x=>x.Roles).Table(“Role”)
.ParentKeyColumn(“RoleId”)
.ChildKeyColumn(“LoginId”);
您知道Fluent/NHibernate是否支持多对多关系,而没有需要复合主键的数据库关联实体(Login_角色)

我希望登录角色使用代理主键

        HasManyToMany<Role>(x => x.Roles).Table("Role")
            .ParentKeyColumn("RoleId")
            .ChildKeyColumn("LoginId");
干杯, 安德鲁

您可以使用:



我认为Fluent还没有公开它。

您可能应该提到为什么希望使用此键而不是使用自然键?这是一个“多对多有效载荷”的场景吗?公司政策?