using System;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using Util.Domain;
using Util.Domain.Auditing;
using Util.Domain.Extending;
using Util.Domain.Trees;
namespace Util.Tests.Models;
///
/// 资源
///
[Description( "资源" )]
public class Resource : TreeEntityBase,IDelete,IAudited,IExtraProperties {
///
/// 初始化资源
///
public Resource() : this( Guid.Empty, "", 0 ) {
}
///
/// 初始化资源
///
/// 资源标识
/// 路径
/// 层级
public Resource( Guid id, string path, int level ) : base( id, path, level ) {
}
///
/// 资源标识符
///
[DisplayName( "资源标识符" )]
[MaxLength( 300 )]
public string Uri { get; set; }
///
/// 资源名称
///
[DisplayName( "资源名称" )]
[Required]
[MaxLength( 200 )]
public string Name { get; set; }
///
/// 备注
///
[DisplayName( "备注" )]
[MaxLength( 500 )]
public string Remark { 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( "是否删除" )]
public bool IsDeleted { get; set; }
///
/// 添加变更列表
///
protected override void AddChanges( Resource other ) {
AddChange( t => t.Uri, other.Uri );
AddChange( t => t.Name, other.Name );
AddChange( t => t.ParentId, other.ParentId );
AddChange( t => t.Path, other.Path );
AddChange( t => t.Level, other.Level );
AddChange( t => t.Remark, other.Remark );
AddChange( t => t.Enabled, other.Enabled );
AddChange( t => t.SortId, other.SortId );
AddChange( t => t.CreationTime, other.CreationTime );
AddChange( t => t.CreatorId, other.CreatorId );
AddChange( t => t.LastModificationTime, other.LastModificationTime );
AddChange( t => t.LastModifierId, other.LastModifierId );
}
}