用流畅的 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,
?
A part of my Model looks like this:
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; }
}
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论