Fluent NHibernate question

后端 未结 4 2138
难免孤独
难免孤独 2021-01-05 04:00

Let\'s say you have two tables, \"Users\" and \"UserRoles\". Here\'s how the two tables are structured (table - columns):

Users - UserID (int)

UserRoles - U

4条回答
  •  一生所求
    2021-01-05 04:30

    This also worked:

    HasMany(u => u.Roles)
                    .WithTableName("UserRoles")
                    .Component(role => role.Map(r => r.Name))
                    .AsList();
    

    You don't need to map Role or UserRoles.

    Make sure Role implements IEquatable < Role > ;.

提交回复
热议问题