Fluent NHibernate question

后端 未结 4 2176
难免孤独
难免孤独 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:39

    I beleive it would be

    public User()
      {
        Id(x => x.UserID);
        HasMany(x => x.UserRoles).AsBag();
      }
    

    You'll also have to make sure you map your UserRoles class as well

提交回复
热议问题