用流利的nhibernate映射继承看起来有点过时了

时间:2011-08-07 06:13:37

标签: c# nhibernate fluent-nhibernate

我的模型的一部分看起来像这样:

public class Person
{
    public virtual Guid Id { get; set; }
    public string Name { get; set; }
}

public class Employee : Person
{
    public virtual int EmployeeNumber { get; set; }
    public virtual Person Partner { get; set; }
}

为此生成的sql是:

create table [Person] (
   Id UNIQUEIDENTIFIER not null,
   Name NVARCHAR(255) null,
   Employee_id UNIQUEIDENTIFIER null,
   primary key (Id)
)

create table Employee (
   Person_id UNIQUEIDENTIFIER not null,
   EmployeeNumber INT null,
   Partner_Id UNIQUEIDENTIFIER null,
   primary key (Person_id)
)

为什么Person表中有Employee_id UNIQUEIDENTIFIER null,

0 个答案:

没有答案