using System; using System.ComponentModel; using System.ComponentModel.DataAnnotations; using Util.Domains; using Util.Domains.Auditing; using Util.Domains.Trees; namespace Util.Samples.Domain.Models { /// /// 角色 /// [Description( "角色" )] public partial class Role : TreeEntityBase, IDelete, IAudited { /// /// 初始化角色 /// public Role() : this( Guid.Empty, "", 0 ) { } /// /// 初始化角色 /// /// 角色标识 /// 路径 /// 级数 public Role( Guid id, string path, int level ) : base( id, path, level ) { } /// /// 角色编码 /// [Required( ErrorMessage = "角色编码不能为空" )] [StringLength( 256, ErrorMessage = "角色编码输入过长,不能超过256位" )] public string Code { get; set; } /// /// 角色名称 /// [Required( ErrorMessage = "角色名称不能为空" )] [StringLength( 256, ErrorMessage = "角色名称输入过长,不能超过256位" )] public string Name { get; set; } /// /// 标准化角色名称 /// [Required( ErrorMessage = "标准化角色名称不能为空" )] [StringLength( 256, ErrorMessage = "标准化角色名称输入过长,不能超过256位" )] public string NormalizedName { get; set; } /// /// 角色类型 /// [Required( ErrorMessage = "角色类型不能为空" )] [StringLength( 80, ErrorMessage = "角色类型输入过长,不能超过80位" )] public string Type { get; set; } /// /// 管理员 /// public bool IsAdmin { get; private set; } /// /// 备注 /// [StringLength( 500, ErrorMessage = "备注输入过长,不能超过500位" )] public string Comment { get; set; } /// /// 拼音简码 /// [StringLength( 200, ErrorMessage = "拼音简码输入过长,不能超过200位" )] public string PinYin { get; set; } /// /// 签名 /// [StringLength( 256, ErrorMessage = "签名输入过长,不能超过256位" )] public string Sign { get; private set; } /// /// 创建时间 /// public DateTime? CreationTime { get; set; } /// /// 创建人编号 /// public Guid? CreatorId { get; set; } /// /// 最后修改时间 /// public DateTime? LastModificationTime { get; set; } /// /// 最后修改人编号 /// public Guid? LastModifierId { get; set; } /// /// 是否删除 /// public bool IsDeleted { get; set; } /// /// 添加描述 /// protected override void AddDescriptions() { AddDescription( t => t.Id ); AddDescription( t => t.Code ); AddDescription( t => t.Name ); AddDescription( t => t.NormalizedName ); AddDescription( t => t.Type ); AddDescription( t => t.IsAdmin ); AddDescription( t => t.ParentId ); AddDescription( t => t.Path ); AddDescription( t => t.Level ); AddDescription( t => t.SortId ); AddDescription( t => t.Enabled ); AddDescription( t => t.Comment ); AddDescription( t => t.PinYin ); AddDescription( t => t.Sign ); AddDescription( t => t.CreationTime ); AddDescription( t => t.CreatorId ); AddDescription( t => t.LastModificationTime ); AddDescription( t => t.LastModifierId ); } /// /// 添加变更列表 /// protected override void AddChanges( Role other ) { AddChange( t => t.Id, other.Id ); AddChange( t => t.Code, other.Code ); AddChange( t => t.Name, other.Name ); AddChange( t => t.NormalizedName, other.NormalizedName ); AddChange( t => t.Type, other.Type ); AddChange( t => t.IsAdmin, other.IsAdmin ); AddChange( t => t.ParentId, other.ParentId ); AddChange( t => t.Path, other.Path ); AddChange( t => t.Level, other.Level ); AddChange( t => t.SortId, other.SortId ); AddChange( t => t.Enabled, other.Enabled ); AddChange( t => t.Comment, other.Comment ); AddChange( t => t.PinYin, other.PinYin ); AddChange( t => t.Sign, other.Sign ); AddChange( t => t.CreationTime, other.CreationTime ); AddChange( t => t.CreatorId, other.CreatorId ); AddChange( t => t.LastModificationTime, other.LastModificationTime ); AddChange( t => t.LastModifierId, other.LastModifierId ); } } }