Fluent NHibernate question

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

    What you're looking for is a of a set of elements, which in standard hbm mapping is:

    
      
      
    
    

    For Fluent NHibernate you can map this like so:

    HasMany(x => x.Roles)
      .AsElement("Role");
    

    You may need to also specify the key name using WithKeyColumn(string).

提交回复
热议问题