mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-09-20 10:38:09 +08:00
Add unit test
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SqlSugarTest
|
||||
{
|
||||
|
||||
public interface IDeleted
|
||||
{
|
||||
/// <summary>
|
||||
/// 默认假删除
|
||||
/// </summary>
|
||||
//[FakeDelete(true)] // 设置假删除的值
|
||||
bool IsDeleted { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 删除用户ID
|
||||
/// </summary>
|
||||
long? DeletedUserId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 删除用户名称
|
||||
/// </summary>
|
||||
string DeletedUserName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 删除时间
|
||||
/// </summary>
|
||||
DateTimeOffset? DeletedTime { get; set; }
|
||||
}
|
||||
}
|
@@ -0,0 +1,51 @@
|
||||
using SqlSugar;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SqlSugarTest
|
||||
{
|
||||
|
||||
[SugarTable("Special", TableDescription = "专题", IsDisabledDelete = true)]
|
||||
public class Special : IDeleted
|
||||
{
|
||||
/// <summary>
|
||||
/// 非自增ID
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnDescription = "ID", IsPrimaryKey = true)]
|
||||
public long Id { get; set; }
|
||||
/// <summary>
|
||||
/// 名称
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnDescription = "名称")]
|
||||
public string Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 默认假删除
|
||||
/// </summary>
|
||||
[System.Text.Json.Serialization.JsonIgnore]
|
||||
[Newtonsoft.Json.JsonIgnore]
|
||||
[SugarColumn(ColumnDescription = "默认假删除", DefaultValue = "false")]
|
||||
public bool IsDeleted { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 删除用户ID
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnDescription = "删除用户ID", IsOnlyIgnoreInsert = true, IsNullable = true)]
|
||||
public long? DeletedUserId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 删除用户
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnDescription = "删除用户", IsNullable = true, IsOnlyIgnoreInsert = true)]
|
||||
public string? DeletedUserName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 删除时间
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnDescription = "删除时间", IsOnlyIgnoreInsert = true, IsNullable = true)]
|
||||
public DateTimeOffset? DeletedTime { get; set; }
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user