实体就是领域中需要唯一标识的领域概念。所以LCL定义了一个实体基类所以的实体都继承这个类,来标记是一个领域实体
public abstract partial class BaseEntity
{
public BaseEntity()
{
AddDate = DateTime.Now;
UpdateDate = DateTime.Now;
}
public static BaseEntity New(Type entityType)
{
return Activator.CreateInstance(entityType, true) as BaseEntity;
}
public int Id { get; set; }
public int Status { get; set; }
public Nullable<datetime> AddDate { get; set; }
public Nullable<datetime> UpdateDate { get; set; }
}
实体示例
public partial class Role : BaseEntity { public Role() { } public string Name { get; set; } }