【发布时间】:2013-01-10 22:24:21
【问题描述】:
我有一个代表部门的对象。部门可以包含多个员工和一个子部门。 Employee 可以包含多个 Employee for 下属。我如何用 Fluent NHibernate 表示这种关系。 Domain 类如下所示:
public class Department : Entitybase
{
public int Id;
public string DepartmentName;
public List<Employee> Employees;
public Department SubDepartment;
}
public class Employee : EntityBase
{
public int Id;
public string Name;
public List<Employee> Subordinates
}
我的数据库表看起来像:
Department Table
Id: int
SubDepartmentId : int // a sub department id
DepartmentName : string
Employee Table
Id : int
SuperviserId : int // A Superviser Id
Name : string
DepartmentId : int // a department id that contain this employee.
如何为选择和插入数据创建流畅的休眠映射。
【问题讨论】:
-
看看你迄今为止提出的映射会很好。您可以将这些添加到问题中吗?
标签: c# fluent-nhibernate