using System; using System.ComponentModel; using System.ComponentModel.DataAnnotations; using Util.Domains; using Util.Domains.Auditing; namespace Util.Samples.Domain.Models { /// /// 应用程序 /// [DisplayName( "应用程序" )] public class Application : AggregateRoot, IDelete, IAudited { /// /// 初始化应用程序 /// public Application() : this( Guid.Empty ) { } /// /// 初始化应用程序 /// /// 应用程序标识 public Application( Guid id ) : base( id ) { } /// /// 应用程序编码 /// [DisplayName( "应用程序编码" )] [Required( ErrorMessage = "应用程序编码不能为空" )] [StringLength( 60, ErrorMessage = "应用程序编码输入过长,不能超过60位" )] public string Code { get; set; } /// /// 应用程序名称 /// [DisplayName( "应用程序名称" )] [Required( ErrorMessage = "应用程序名称不能为空" )] [StringLength( 200, ErrorMessage = "应用程序名称输入过长,不能超过200位" )] public string Name { get; set; } /// /// 备注 /// [DisplayName( "备注" )] [StringLength( 500, ErrorMessage = "备注输入过长,不能超过500位" )] public string Comment { get; set; } /// /// 启用 /// [DisplayName( "启用" )] [Required( ErrorMessage = "启用不能为空" )] public bool Enabled { get; set; } /// /// 启用注册 /// [DisplayName( "启用注册" )] [Required( ErrorMessage = "启用注册不能为空" )] public bool RegisterEnabled { get; set; } /// /// 创建时间 /// [DisplayName( "创建时间" )] public DateTime? CreationTime { get; set; } /// /// 创建人编号 /// [DisplayName( "创建人编号" )] public Guid? CreatorId { get; set; } /// /// 最后修改时间 /// [DisplayName( "最后修改时间" )] public DateTime? LastModificationTime { get; set; } /// /// 最后修改人编号 /// [DisplayName( "最后修改人编号" )] public Guid? LastModifierId { get; set; } /// /// 是否删除 /// [DisplayName( "是否删除" )] [Required( ErrorMessage = "是否删除不能为空" )] public bool IsDeleted { get; set; } /// /// 添加描述 /// protected override void AddDescriptions() { AddDescription( t => t.Id ); AddDescription( t => t.Code ); AddDescription( t => t.Name ); AddDescription( t => t.Comment ); AddDescription( t => t.Enabled ); AddDescription( t => t.RegisterEnabled ); AddDescription( t => t.CreationTime ); AddDescription( t => t.CreatorId ); AddDescription( t => t.LastModificationTime ); AddDescription( t => t.LastModifierId ); } /// /// 添加变更列表 /// protected override void AddChanges( Application other ) { AddChange( t => t.Id, other.Id ); AddChange( t => t.Code, other.Code ); AddChange( t => t.Name, other.Name ); AddChange( t => t.Comment, other.Comment ); AddChange( t => t.Enabled, other.Enabled ); AddChange( t => t.RegisterEnabled, other.RegisterEnabled ); AddChange( t => t.CreationTime, other.CreationTime ); AddChange( t => t.CreatorId, other.CreatorId ); AddChange( t => t.LastModificationTime, other.LastModificationTime ); AddChange( t => t.LastModifierId, other.LastModifierId ); } } }