From c4c6791ac7f379c8a72a94a3cc6e32ee0ed9adc0 Mon Sep 17 00:00:00 2001 From: sunkaixuan <610262374@qq.com> Date: Sat, 23 Dec 2023 17:39:41 +0800 Subject: [PATCH] Update TDengine demo --- Src/Asp.NetCore2/TDengineTest/Demo/ORMTest.cs | 13 +++++++++- .../TDengineTest/Demo/ORMTest_Partial/Time.cs | 25 +++++++++++++++++-- 2 files changed, 35 insertions(+), 3 deletions(-) diff --git a/Src/Asp.NetCore2/TDengineTest/Demo/ORMTest.cs b/Src/Asp.NetCore2/TDengineTest/Demo/ORMTest.cs index d2260ec0c..927fc4436 100644 --- a/Src/Asp.NetCore2/TDengineTest/Demo/ORMTest.cs +++ b/Src/Asp.NetCore2/TDengineTest/Demo/ORMTest.cs @@ -6,7 +6,8 @@ using System.Linq; using System.Runtime.CompilerServices; using System.Text; using System.Threading.Tasks; -using SqlSugar; +using SqlSugar; +using SqlSugar.DbConvert; namespace TDengineTest { @@ -26,6 +27,16 @@ namespace TDengineTest { Console.WriteLine(UtilMethods.GetNativeSql(sql, p)); } + }, + ConfigureExternalServices = new ConfigureExternalServices() + { + EntityService= (property, column) => + { + if (column.SqlParameterDbType == null) + { + column.SqlParameterDbType = typeof(CommonPropertyConvert); + } + } } }); diff --git a/Src/Asp.NetCore2/TDengineTest/Demo/ORMTest_Partial/Time.cs b/Src/Asp.NetCore2/TDengineTest/Demo/ORMTest_Partial/Time.cs index 511cb42d8..2934219ef 100644 --- a/Src/Asp.NetCore2/TDengineTest/Demo/ORMTest_Partial/Time.cs +++ b/Src/Asp.NetCore2/TDengineTest/Demo/ORMTest_Partial/Time.cs @@ -3,6 +3,7 @@ using System; using System.Collections.Generic; using System.Text; using System.Linq; +using SqlSugar.DbConvert; namespace TDengineTest { public partial class ORMTest @@ -21,7 +22,17 @@ namespace TDengineTest { DbType = SqlSugar.DbType.TDengine, IsAutoCloseConnection = true, - ConnectionString = "Host=localhost;Port=6030;Username=root;Password=taosdata;Database=nstest;TsType=config_ns" + ConnectionString = "Host=localhost;Port=6030;Username=root;Password=taosdata;Database=nstest;TsType=config_ns", + ConfigureExternalServices = new ConfigureExternalServices() + { + EntityService = (property, column) => + { + if (column.SqlParameterDbType == null) + { + column.SqlParameterDbType = typeof(CommonPropertyConvert); + } + } + } }); //删除库-库上限比太少只能删了测试 @@ -97,7 +108,17 @@ VALUES ('2023-09-23', ""10.2"", ""A219"",""2309050001"",""B03123"",""OK"",""681- { DbType = SqlSugar.DbType.TDengine, IsAutoCloseConnection = true, - ConnectionString = "Host=localhost;Port=6030;Username=root;Password=taosdata;Database=nstest;TsType=config_us" + ConnectionString = "Host=localhost;Port=6030;Username=root;Password=taosdata;Database=nstest;TsType=config_us", + ConfigureExternalServices = new ConfigureExternalServices() + { + EntityService = (property, column) => + { + if (column.SqlParameterDbType == null) + { + column.SqlParameterDbType = typeof(CommonPropertyConvert); + } + } + } }); //删除库-库上限比太少只能删了测试 db.Ado.ExecuteCommand("drop database nstest");