mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-08-24 07:22:57 +08:00
Add user case test
This commit is contained in:
parent
bc42293eb5
commit
6f9d899275
@ -66,8 +66,32 @@ namespace OrmTest
|
|||||||
// Query all students again
|
// Query all students again
|
||||||
// 再次查询所有学生
|
// 再次查询所有学生
|
||||||
var list = db.Queryable<Student>().ToList();
|
var list = db.Queryable<Student>().ToList();
|
||||||
|
|
||||||
|
db.CodeFirst.InitTables<MarkerEntity>();
|
||||||
|
db.Context
|
||||||
|
.Deleteable<MarkerEntity>(a => a.MarkTime.AddDays(a.KeepDays) < DateTime.Now)
|
||||||
|
.ExecuteCommandAsync().GetAwaiter().GetResult();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[SugarTable("Marker")]
|
||||||
|
|
||||||
|
public class MarkerEntity
|
||||||
|
|
||||||
|
{
|
||||||
|
|
||||||
|
[SugarColumn(IsPrimaryKey = true, IsIdentity = true)]
|
||||||
|
|
||||||
|
public int Id { get; set; }
|
||||||
|
|
||||||
|
public DateTime MarkTime { get; set; }
|
||||||
|
|
||||||
|
public string Tag { get; set; }
|
||||||
|
|
||||||
|
public string Value { get; set; }
|
||||||
|
|
||||||
|
public int KeepDays { get; set; } = 7;
|
||||||
|
|
||||||
|
}
|
||||||
// Define the entity class 定义实体类
|
// Define the entity class 定义实体类
|
||||||
[SugarTable("UnitSaveTablea5")]
|
[SugarTable("UnitSaveTablea5")]
|
||||||
public class Student
|
public class Student
|
||||||
|
Loading…
Reference in New Issue
Block a user