Update TDengine demo

This commit is contained in:
sunkaixuan 2023-12-23 17:39:41 +08:00
parent 381f9691cc
commit c4c6791ac7
2 changed files with 35 additions and 3 deletions

View File

@ -6,7 +6,8 @@ using System.Linq;
using System.Runtime.CompilerServices; using System.Runtime.CompilerServices;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using SqlSugar; using SqlSugar;
using SqlSugar.DbConvert;
namespace TDengineTest namespace TDengineTest
{ {
@ -26,6 +27,16 @@ namespace TDengineTest
{ {
Console.WriteLine(UtilMethods.GetNativeSql(sql, p)); Console.WriteLine(UtilMethods.GetNativeSql(sql, p));
} }
},
ConfigureExternalServices = new ConfigureExternalServices()
{
EntityService= (property, column) =>
{
if (column.SqlParameterDbType == null)
{
column.SqlParameterDbType = typeof(CommonPropertyConvert);
}
}
} }
}); });

View File

@ -3,6 +3,7 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
using System.Linq; using System.Linq;
using SqlSugar.DbConvert;
namespace TDengineTest namespace TDengineTest
{ {
public partial class ORMTest public partial class ORMTest
@ -21,7 +22,17 @@ namespace TDengineTest
{ {
DbType = SqlSugar.DbType.TDengine, DbType = SqlSugar.DbType.TDengine,
IsAutoCloseConnection = true, 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, DbType = SqlSugar.DbType.TDengine,
IsAutoCloseConnection = true, 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"); db.Ado.ExecuteCommand("drop database nstest");