我有一个继承自Base类的POCO类。我正在使用EF Power Tools来显示实体数据模型。我注意到的是,五个属性中只有两个是从基类显示的。这是一个例子:
基类:
using System;
namespace App.Model
{
[Serializable()]
public abstract class BaseEntity
{
public bool IsActive { get; private set; }
public DateTimeOffset Created { get; private set; }
public string CreatedBy { get; private set; }
public DateTimeOffset LastUpdated { get; protected set; }
public string LastUpdatedBy { get; protected set; }
private BaseEntity() { }
protected BaseEntity(DateTimeOffset created, string createdBy)
{
IsActive = true;
Created = created;
CreatedBy = createdBy;
LastUpdated = created;
LastUpdatedBy = createdBy;
}
}
}
继承类:
using System;
namespace App.Model
{
[Serializable()]
public class Person : BaseEntity
{
public int Id { get; set; }
public string FirstName { get; set; }
public string LastName { get; set; }
public string Email { get; set; }
public Person(DateTimeOffset created, string createdBy) :
base(created, createdBy) { }
}
}
只有LastUpdated和LastUpdated才能显示在模型中:
我认为它可能与受保护的vs私有的setter有关,所以我尝试将其他三个未显示的属性设置为protected并重新启动该工具。它仍然没有创建IsActive,Created和CreatedBy字段。
导致此问题的原因是什么以及如何让所有五个字段出现在模型中?