using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using Util.Domain;
using Util.Domain.Auditing;
using Util.Domain.Entities;
namespace Util.Tests.Models;
///
/// 贴子
///
[Description( "贴子" )]
public class Post : AggregateRoot, IDelete, IAudited {
///
/// 初始化贴子
///
public Post() : this( Guid.Empty ) {
}
///
/// 初始化贴子
///
/// 贴子标识
public Post( Guid id ) : base( id ) {
Tags = new List();
}
///
/// 标题
///
[Description( "标题" )]
[MaxLength( 200 )]
public string Title { get; set; }
///
/// 内容
///
[Description( "内容" )]
public string Content { get; set; }
///
/// 创建时间
///
[Description( "创建时间" )]
public DateTime? CreationTime { get; set; }
///
/// 创建人
///
[Description( "创建人" )]
public Guid? CreatorId { get; set; }
///
/// 最后修改时间
///
[Description( "最后修改时间" )]
public DateTime? LastModificationTime { get; set; }
///
/// 最后修改人
///
[Description( "最后修改人" )]
public Guid? LastModifierId { get; set; }
///
/// 是否删除
///
[Description( "是否删除" )]
public bool IsDeleted { get; set; }
///
/// 标签列表
///
public ICollection Tags { get; set; }
///
/// 添加变更列表
///
protected override void AddChanges( Post other ) {
AddChange( t => t.Title, other.Title );
AddChange( t => t.Content, other.Content );
AddChange( t => t.CreationTime, other.CreationTime );
AddChange( t => t.CreatorId, other.CreatorId );
AddChange( t => t.LastModificationTime, other.LastModificationTime );
AddChange( t => t.LastModifierId, other.LastModifierId );
AddChange( t => t.ExtraProperties, other.ExtraProperties );
}
}