开发者

Mapping inheritance with fluent nhibernate seems a bit off

开发者 https://www.devze.com 2023-03-26 16:13 出处:网络
A part of my Model looks like this: public class Person { public virtual Guid Id { get; set; } public s开发者_Python百科tring Name { get; set; }

A part of my Model looks like this:

public class Person
{
    public virtual Guid Id { get; set; }
    public s开发者_Python百科tring Name { get; set; }
}

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

The generated sql for this is:

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)
)

Why is there a Employee_id UNIQUEIDENTIFIER null, inside the Person table?

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号