Fluent NHibernate HasMany Foreign Key Mapping Problem

后端 未结 3 1036
终归单人心
终归单人心 2021-02-06 04:20

I\'m trying to map a simple data structure in nhibernate

Tables:

Employees
employeeID int
username varchar(30)
departmentID int

Departm         


        
3条回答
  •  梦毁少年i
    2021-02-06 04:56

    You may either: create a Fluent NHibernate convention so that the HasMany "foreign key" is created as <'Name'>ID.

    Or change the Department mapping:

     HasMany(m => m.Employees).KeyColumns.Add("DepartmentID")
    

提交回复
热议问题