From 6c961c3d46e3df2faee6981e59f2d9e5b9d3fe95 Mon Sep 17 00:00:00 2001 From: sunkaixuan <610262374@qq.com> Date: Sun, 1 Oct 2023 20:16:14 +0800 Subject: [PATCH] Update TDengine --- Src/Asp.NetCore2/TDengineTest/Demo/ORMTest.cs | 2 +- .../Demo/ORMTest_Partial/1_CodeFirts.cs | 33 +++++++++++++++---- .../Models/Unit/CodeFirstTest1.cs | 15 ++++++--- 3 files changed, 38 insertions(+), 12 deletions(-) diff --git a/Src/Asp.NetCore2/TDengineTest/Demo/ORMTest.cs b/Src/Asp.NetCore2/TDengineTest/Demo/ORMTest.cs index e8bc1874e..5a3e1ceed 100644 --- a/Src/Asp.NetCore2/TDengineTest/Demo/ORMTest.cs +++ b/Src/Asp.NetCore2/TDengineTest/Demo/ORMTest.cs @@ -29,7 +29,7 @@ namespace TDengineTest } } }); - + //建表 CodeFirst(db); diff --git a/Src/Asp.NetCore2/TDengineTest/Demo/ORMTest_Partial/1_CodeFirts.cs b/Src/Asp.NetCore2/TDengineTest/Demo/ORMTest_Partial/1_CodeFirts.cs index a8fb22c2d..6a9c9db97 100644 --- a/Src/Asp.NetCore2/TDengineTest/Demo/ORMTest_Partial/1_CodeFirts.cs +++ b/Src/Asp.NetCore2/TDengineTest/Demo/ORMTest_Partial/1_CodeFirts.cs @@ -11,17 +11,36 @@ namespace TDengineTest { CodeFirst1(db); - db.CodeFirst.InitTables(); - db.Insertable(new AllCSharpTypes() { Ts = DateTime.Now, Boolean = true, Char = 'a', Decimal = Convert.ToDecimal(18.2), Int16 = 1, Int32 = 1, Int64 = 1, String = "2" }).ExecuteCommand(); - var list3 = db.Queryable().ToList(); - db.CodeFirst.InitTables(); + db.CodeFirst.InitTables(); + db.Insertable(new CodeFirst03() + { + Ts = DateTime.Now, + Boolean = true, + Char = 'a', + Decimal = Convert.ToDecimal(18.2), + Int16 = 16, + Int32 = 32, + Int64 = 64, + String = "string", + SByte=3, + Byte = 2, + Decimal2 = Convert.ToDecimal(18.3), + Double = Convert.ToDouble(18.44), + Float = Convert.ToSingle(18.45), + String2 = "2", + UInt16=116, + UInt32=332, + UInt64=664 + }).ExecuteCommand(); + var dt = db.Ado.GetDataTable("select * from CodeFirst03 "); + var list3 = db.Queryable().ToList(); } private static void CodeFirst1(SqlSugarClient db) { - db.CodeFirst.InitTables(); - db.Insertable(new CodeFirst1() { Boolean = true, Ts = DateTime.Now }).ExecuteCommand(); - var list = db.Queryable().ToList(); + db.CodeFirst.InitTables(); + db.Insertable(new CodeFirst01() { Boolean = true, Ts = DateTime.Now }).ExecuteCommand(); + var list = db.Queryable().ToList(); } } } diff --git a/Src/Asp.NetCore2/TDengineTest/Models/Unit/CodeFirstTest1.cs b/Src/Asp.NetCore2/TDengineTest/Models/Unit/CodeFirstTest1.cs index 7e4f0e865..d8494ee4c 100644 --- a/Src/Asp.NetCore2/TDengineTest/Models/Unit/CodeFirstTest1.cs +++ b/Src/Asp.NetCore2/TDengineTest/Models/Unit/CodeFirstTest1.cs @@ -1,17 +1,20 @@ -using SqlSugar.TDengine; +using SqlSugar.DbConvert; +using SqlSugar.TDengine; using System; using System.Collections.Generic; using System.Text; namespace TDengineTest { - [SqlSugar.SugarTable("AllCSharpTypes09")] - public class AllCSharpTypes : STable + + public class CodeFirst03 : STable { [SqlSugar.SugarColumn(IsPrimaryKey = true)] public DateTime Ts { get; set; } public bool Boolean { get; set; } + [SqlSugar.SugarColumn(SqlParameterDbType = typeof(CommonPropertyConvert))] public byte Byte { get; set; } + [SqlSugar.SugarColumn(SqlParameterDbType =typeof(CommonPropertyConvert))] public sbyte SByte { get; set; } public char Char { get; set; } public decimal Decimal { get; set; } @@ -19,12 +22,16 @@ namespace TDengineTest public decimal Decimal2 { get; set; } [SqlSugar.SugarColumn(Length = 18, DecimalDigits = 2)] public double Double { get; set; } + [SqlSugar.SugarColumn(SqlParameterDbType = typeof(CommonPropertyConvert))] public float Float { get; set; } public int Int32 { get; set; } + [SqlSugar.SugarColumn(SqlParameterDbType = typeof(CommonPropertyConvert))] public uint UInt32 { get; set; } public long Int64 { get; set; } + [SqlSugar.SugarColumn(SqlParameterDbType = typeof(CommonPropertyConvert))] public ulong UInt64 { get; set; } public short Int16 { get; set; } + [SqlSugar.SugarColumn(SqlParameterDbType = typeof(CommonPropertyConvert))] public ushort UInt16 { get; set; } public string String { get; set; } [SqlSugar.SugarColumn(Length = 100)] @@ -32,7 +39,7 @@ namespace TDengineTest } - public class CodeFirst1 : STable + public class CodeFirst01 : STable { [SqlSugar.SugarColumn(IsPrimaryKey = true)] public DateTime Ts { get; set; }