Update TDengine

This commit is contained in:
sunkaixuan 2023-10-01 20:16:14 +08:00
parent 7896b00dc1
commit 6c961c3d46
3 changed files with 38 additions and 12 deletions

View File

@ -29,7 +29,7 @@ namespace TDengineTest
}
}
});
//建表
CodeFirst(db);

View File

@ -11,17 +11,36 @@ namespace TDengineTest
{
CodeFirst1(db);
db.CodeFirst.InitTables<AllCSharpTypes>();
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<AllCSharpTypes>().ToList();
db.CodeFirst.InitTables<AllCSharpTypes>();
db.CodeFirst.InitTables<CodeFirst03>();
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<CodeFirst03>().ToList();
}
private static void CodeFirst1(SqlSugarClient db)
{
db.CodeFirst.InitTables<CodeFirst1>();
db.Insertable(new CodeFirst1() { Boolean = true, Ts = DateTime.Now }).ExecuteCommand();
var list = db.Queryable<CodeFirst1>().ToList();
db.CodeFirst.InitTables<CodeFirst01>();
db.Insertable(new CodeFirst01() { Boolean = true, Ts = DateTime.Now }).ExecuteCommand();
var list = db.Queryable<CodeFirst01>().ToList();
}
}
}

View File

@ -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; }