0
我有流动类:对于我的情况,EF中最适合的继承类型是什么?
public abstract class Person
{
//...
public DateTime CteatedAt{get;set;}
public DateTime UpdatedAt{get;set;}
// ....
}
public class Employee : Person
{
// ...
public DateTime CreatedAt{get;set;}
public DateTime UpdatedAt{get;set;}
// ...
}
,我想数据库表是看起来像: - People表:(ID,...,createdat,updatedat); - 员工表:(id,...,createdat,updatedat);
并且在代码中,当我需要人员创建日期时,我会这样做: Employee em; datetime pcd =(Person)em.CreatedAt; 当我需要员工创建日期: datetime ecd = em.CreatedAt;
请问我的案例最适合的继承类型是什么?
谢谢@JesseJames,但我想让代码如此简单,我不喜欢使用导航属性。 –