标签:syn null new queryable tco 技术 amp 查询 bit
CREATE TABLE dbo.Test
(
tId INT IDENTITY NOT NULL
, tName NVARCHAR (20) NOT NULL
, tSalary DECIMAL (8, 2) NULL
, tTimeStamp TIMESTAMP
)
public partial class Test
{
[SugarColumn(IsOnlyIgnoreInsert =true)]
public int tId { get; set; }
public string tName { get; set; }
public decimal? tSalary { get; set; }
[SugarColumn(IsOnlyIgnoreInsert = true)]
public byte[] tTimeStamp { get; set; }
}
SqlSugar.DB.Insertable<Test>(new Test { tName = "Jerry", tSalary = (decimal)7238.04 }).ExecuteCommand();
在Test类的 tTimeStamp 属性上添加[SugarColumn(IsOnlyIgnoreInsert = true)]
,否则会出错。
var list = await SqlSugar.DB.Queryable<Test>().ToListAsync();
list.ForEach(x => Console.WriteLine($"{x.tId} {x.tName} {x.tSalary} {BitConverter.ToString(x.tTimeStamp).Replace("-","")}"));
根据时间戳查询,目标是第二条
var list = await SqlSugar.DB.Queryable<Test>().ToListAsync();
var query = await SqlSugar.DB.Queryable<Test>().Where(x => x.tTimeStamp == list[1].tTimeStamp).ToListAsync();
query.ForEach(x => Console.WriteLine($"{x.tId} {x.tName} {x.tSalary} {BitConverter.ToString(x.tTimeStamp).Replace("-","")}"));
标签:syn null new queryable tco 技术 amp 查询 bit
原文地址:https://www.cnblogs.com/zhaoshujie/p/12268272.html