Update TDengine DEMO

This commit is contained in:
sunkaixuan 2023-10-01 20:36:31 +08:00
parent 0225acd80c
commit e94afe061b
2 changed files with 16 additions and 2 deletions

View File

@ -15,6 +15,9 @@ namespace TDengineTest
//简单建表 //简单建表
CodeFirst1(db); CodeFirst1(db);
//简单建表
CodeFirst2(db);
//更多建表用例 //更多建表用例
db.CodeFirst.InitTables<CodeFirst03>(); db.CodeFirst.InitTables<CodeFirst03>();
db.Insertable(new CodeFirst03() db.Insertable(new CodeFirst03()
@ -47,5 +50,11 @@ namespace TDengineTest
db.Insertable(new CodeFirst01() { Boolean = true, Ts = DateTime.Now }).ExecuteCommand(); db.Insertable(new CodeFirst01() { Boolean = true, Ts = DateTime.Now }).ExecuteCommand();
var list = db.Queryable<CodeFirst01>().ToList(); var list = db.Queryable<CodeFirst01>().ToList();
} }
private static void CodeFirst2(SqlSugarClient db)
{
db.CodeFirst.InitTables<CodeFirst04>();
db.Insertable(new CodeFirst04() { Boolean = true, Ts = DateTime.Now }).ExecuteCommand();
var list = db.Queryable<CodeFirst04>().ToList();
}
} }
} }

View File

@ -38,8 +38,13 @@ namespace TDengineTest
public string String2 { get; set; } public string String2 { get; set; }
} }
public class CodeFirst01:STable
public class CodeFirst01 : STable {
[SqlSugar.SugarColumn(IsPrimaryKey = true)]
public DateTime Ts { get; set; }
public bool Boolean { get; set; }
}
public class CodeFirst04
{ {
[SqlSugar.SugarColumn(IsPrimaryKey = true)] [SqlSugar.SugarColumn(IsPrimaryKey = true)]
public DateTime Ts { get; set; } public DateTime Ts { get; set; }