48 lines
1.3 KiB
C#
48 lines
1.3 KiB
C#
using System;
|
||
using Newtonsoft.Json;
|
||
using Newtonsoft.Json.Serialization;
|
||
|
||
namespace Hncore.Infrastructure.DDD
|
||
{
|
||
/// <summary>
|
||
/// 实现模型抽象基类
|
||
/// </summary>
|
||
/// <typeparam name="TId">主键数据类型</typeparam>
|
||
public abstract class Entity<TId> : IEntity<TId>
|
||
{
|
||
/// <summary>
|
||
/// 记录数据库主键ID
|
||
/// </summary>
|
||
[JsonProperty("Id")]
|
||
public virtual TId Id { get; set; }
|
||
}
|
||
|
||
public abstract class EntityWithTime<TId> : Entity<TId>
|
||
{
|
||
/// <summary>
|
||
/// 记录添加(创建)时间
|
||
/// </summary>
|
||
public virtual DateTime CreateTime { get; set; } = DateTime.Now;
|
||
|
||
/// <summary>
|
||
/// 记录最后更新时间
|
||
/// </summary>
|
||
public virtual DateTime UpdateTime { get; set; } = DateTime.Now;
|
||
|
||
/// <summary>
|
||
/// 记录软删除标记,0.代表正常,1.代表已删除
|
||
/// </summary>
|
||
public virtual int DeleteTag { get; set; }
|
||
|
||
}
|
||
|
||
public abstract class EntityWithDelete<TId> : Entity<TId>,ISoftDelete
|
||
{
|
||
/// <summary>
|
||
/// 记录软删除标记,0.代表正常,1.代表已删除
|
||
/// </summary>
|
||
public virtual int DeleteTag { get; set; } = 0;
|
||
|
||
}
|
||
|
||
} |