Add TDengine Demo

This commit is contained in:
sunkaixuan 2023-10-01 20:50:22 +08:00
parent 07f76e56f3
commit 0db5698993
2 changed files with 21 additions and 1 deletions

View File

@ -18,6 +18,8 @@ namespace TDengineTest
//简单建表
CodeFirst2(db);
CodeFirst4(db);
//更多建表用例
db.CodeFirst.InitTables<CodeFirst03>();
db.Insertable(new CodeFirst03()
@ -56,5 +58,17 @@ namespace TDengineTest
db.Insertable(new CodeFirst04() { Boolean = true, Ts = DateTime.Now }).ExecuteCommand();
var list = db.Queryable<CodeFirst04>().ToList();
}
private static void CodeFirst4(SqlSugarClient db)
{
db.CurrentConnectionConfig.MoreSettings = new ConnMoreSettings()
{
PgSqlIsAutoToLower = false,
PgSqlIsAutoToLowerCodeFirst = false,
};
db.CodeFirst.InitTables<CodeFirst05>();
db.Insertable(new CodeFirst05() { Boolean = true, Ts = DateTime.Now }).ExecuteCommand();
var list = db.Queryable<CodeFirst05>().ToList();
}
}
}

View File

@ -49,5 +49,11 @@ namespace TDengineTest
[SqlSugar.SugarColumn(IsPrimaryKey = true)]
public DateTime Ts { get; set; }
public bool Boolean { get; set; }
}
}
public class CodeFirst05
{
[SqlSugar.SugarColumn(IsPrimaryKey = true)]
public DateTime Ts { get; set; }
public bool Boolean { get; set; }
}
}