Files
juipnet/Infrastructure/Hncore.Infrastructure/DDD/Entity.cs
“wanyongkang” 40a40b6d36 忽略
2020-12-28 14:55:48 +08:00

48 lines
1.3 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
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;
}
}