diff --git a/FreeSql.Tests/FreeSql.Tests.Provider.TDengine/FreeSql.Tests.Provider.TDengine.csproj b/FreeSql.Tests/FreeSql.Tests.Provider.TDengine/FreeSql.Tests.Provider.TDengine.csproj
new file mode 100644
index 000000000..8769da46d
--- /dev/null
+++ b/FreeSql.Tests/FreeSql.Tests.Provider.TDengine/FreeSql.Tests.Provider.TDengine.csproj
@@ -0,0 +1,27 @@
+
+
+
+ net8.0
+ enable
+ enable
+
+ false
+ true
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/FreeSql.Tests/FreeSql.Tests.Provider.TDengine/TDengine/TDengineAdo/TDengineAdoTest.cs b/FreeSql.Tests/FreeSql.Tests.Provider.TDengine/TDengine/TDengineAdo/TDengineAdoTest.cs
new file mode 100644
index 000000000..065e2d146
--- /dev/null
+++ b/FreeSql.Tests/FreeSql.Tests.Provider.TDengine/TDengine/TDengineAdo/TDengineAdoTest.cs
@@ -0,0 +1,104 @@
+using System;
+using FreeSql.Tests.Provider.TDengine.TDengine.Tables;
+using Xunit;
+
+namespace FreeSql.Tests.Provider.TDengine.TDengine.TDengineAdo
+{
+ public class TDengineAdoTest
+ {
+ IFreeSql fsql => g.tdengine;
+
+ [Fact]
+ void CodeFirstTest()
+ {
+ fsql.CodeFirst.SyncStructure();
+ fsql.CodeFirst.SyncStructure();
+ fsql.CodeFirst.SyncStructure();
+ }
+
+ [Fact]
+ void InsertTest()
+ {
+ var insertAffrows = fsql.Insert(new D1001()
+ {
+ Ts = DateTime.Now,
+ Current = 1,
+ Voltage = 1,
+ Describe = "D10021"
+ }
+ ).ExecuteAffrows();
+
+ var insertAffrows2 = fsql.Insert(new D1001()
+ {
+ Ts = DateTime.Now,
+ Current = 1,
+ Voltage = 1,
+ Describe = "D10021"
+ }
+ ).ExecuteAffrows();
+
+ var batchInsertAffrows = fsql.Insert(new List()
+ {
+ new D1002()
+ {
+ Ts = DateTime.Now,
+ Current = 6,
+ Voltage = 6,
+ Describe = "D10026"
+ },
+ new D1002()
+ {
+ Ts = DateTime.Now,
+ Current = 3,
+ Voltage = 3,
+ Describe = "D10023"
+ },
+ new D1002()
+ {
+ Ts = DateTime.Now,
+ Current = 4,
+ Voltage = 4,
+ Describe = "D10024"
+ }
+ }
+ ).ExecuteAffrows();
+ }
+
+ [Fact]
+ void SelectTest()
+ {
+ var subList = fsql.Select().ToList(d => new
+ {
+ GroupId = d.GroupId
+ });
+
+ var superMetersList = fsql.Select().ToList();
+ }
+
+ [Fact]
+ void WhereSelectTest()
+ {
+ var list = fsql.Select().Where(d => d.GroupId == 2).ToList();
+ }
+
+ [Fact]
+ void DeleteTest()
+ {
+ var startTime = DateTime.Parse("2024-11-30T02:33:52.308+00:00");
+ var endTime = DateTime.Parse("2024-11-30T02:40:58.961+00:00");
+ var executeAffrows = fsql.Delete()
+ .Where(meters => meters.Ts >= startTime && meters.Ts <= endTime && meters.GroupId == 1)
+ .ExecuteAffrows();
+ }
+
+ [Fact]
+ void DbFirst_GetDatabases()
+ {
+ var databases = fsql.DbFirst.GetDatabases();
+ foreach (var database in databases)
+ {
+ Console.WriteLine(database);
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/FreeSql.Tests/FreeSql.Tests.Provider.TDengine/TDengine/Tables/Meters.cs b/FreeSql.Tests/FreeSql.Tests.Provider.TDengine/TDengine/Tables/Meters.cs
new file mode 100644
index 000000000..f932ab5e6
--- /dev/null
+++ b/FreeSql.Tests/FreeSql.Tests.Provider.TDengine/TDengine/Tables/Meters.cs
@@ -0,0 +1,52 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using FreeSql.DataAnnotations;
+using FreeSql.Provider.TDengine.Attributes;
+
+namespace FreeSql.Tests.Provider.TDengine.TDengine.Tables
+{
+ [TDengineSuperTable(Name = "meters")]
+ public class Meters
+ {
+ [Column(Name = "ts")]
+ public DateTime Ts { get; set; }
+
+ [Column(Name = "current")]
+ public float Current { get; set; }
+
+ [Column(Name = "voltage")]
+ public int Voltage { get; set; }
+
+ [Column(Name = "describe", StringLength = 50)]
+ public string? Describe { get; set; }
+
+ [TDengineTag(Name = "location")]
+ public virtual string? Location { get; set; }
+
+ [TDengineTag(Name = "group_id")]
+ public virtual int GroupId { get; set; }
+ }
+
+ [TDengineSubTable(SuperTableName = "meters", Name = "d1001")]
+ public class D1001 : Meters
+ {
+ [TDengineTag(Name = "location")]
+ public override string Location { get; set; } = "BeiJIng.ChaoYang";
+
+ [TDengineTag(Name = "group_id")]
+ public override int GroupId { get; set; } = 1;
+ }
+
+ [TDengineSubTable(SuperTableName = "meters", Name = "d1002")]
+ public class D1002 : Meters
+ {
+ [TDengineTag(Name = "location")]
+ public new string Location { get; set; } = "California.SanFrancisco";
+
+ [TDengineTag(Name = "group_id")]
+ public new int GroupId { get; set; } = 2;
+ }
+}
\ No newline at end of file
diff --git a/FreeSql.Tests/FreeSql.Tests.Provider.TDengine/TDengine/Tables/Users.cs b/FreeSql.Tests/FreeSql.Tests.Provider.TDengine/TDengine/Tables/Users.cs
new file mode 100644
index 000000000..9d3fea7a5
--- /dev/null
+++ b/FreeSql.Tests/FreeSql.Tests.Provider.TDengine/TDengine/Tables/Users.cs
@@ -0,0 +1,25 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using FreeSql.DataAnnotations;
+
+namespace FreeSql.Tests.Provider.TDengine.TDengine.Tables
+{
+ [Table(Name = "users")]
+ public class Users
+ {
+ [Column(Name = "ts")]
+ public DateTime Ts { get; set; }
+
+ [Column(Name = "id")]
+ public float Id { get; set; }
+
+ [Column(Name = "address")]
+ public int Address { get; set; }
+
+ [Column(Name = "name", StringLength = 20)]
+ public string? Name { get; set; }
+ }
+}
diff --git a/FreeSql.Tests/FreeSql.Tests.Provider.TDengine/TDengineAdo/TDengineAdoTest.cs b/FreeSql.Tests/FreeSql.Tests.Provider.TDengine/TDengineAdo/TDengineAdoTest.cs
new file mode 100644
index 000000000..8fcd64b11
--- /dev/null
+++ b/FreeSql.Tests/FreeSql.Tests.Provider.TDengine/TDengineAdo/TDengineAdoTest.cs
@@ -0,0 +1,14 @@
+namespace FreeSql.Tests.Provider.TDengine.TDengineAdo
+{
+ public class TDengineAdoTest
+ {
+ IFreeSql fsql => g.tdengine;
+
+ [Fact]
+ public void AuditValue()
+ {
+ var executeConnectTest = fsql.Ado.ExecuteConnectTest();
+
+ }
+ }
+}
diff --git a/FreeSql.Tests/FreeSql.Tests.Provider.TDengine/g.cs b/FreeSql.Tests/FreeSql.Tests.Provider.TDengine/g.cs
new file mode 100644
index 000000000..e8d31270c
--- /dev/null
+++ b/FreeSql.Tests/FreeSql.Tests.Provider.TDengine/g.cs
@@ -0,0 +1,26 @@
+using System;
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.Linq;
+using System.Text;
+using System.Threading;
+using System.Threading.Tasks;
+
+namespace FreeSql.Tests.Provider.TDengine
+{
+ internal class g
+ {
+ private static readonly Lazy tdengineLazy = new Lazy(() =>
+ {
+ var fsql = new FreeSql.FreeSqlBuilder()
+ .UseConnectionString(FreeSql.DataType.TDengine,
+ "host=localhost;port=6030;username=root;password=taosdata;protocol=Native;db=test;")
+ .UseMonitorCommand(cmd => Console.WriteLine($"Sql:{cmd.CommandText}\r\n"))
+ .UseNoneCommandParameter(true)
+ .Build();
+ return fsql;
+ });
+
+ public static IFreeSql tdengine => tdengineLazy.Value;
+ }
+}
\ No newline at end of file
diff --git a/FreeSql.sln b/FreeSql.sln
index b556b639e..ee33927be 100644
--- a/FreeSql.sln
+++ b/FreeSql.sln
@@ -131,6 +131,10 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FreeSql.Provider.Duckdb", "
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FreeSql.Tests.Provider.Duckdb", "FreeSql.Tests\FreeSql.Tests.Provider.Duckdb\FreeSql.Tests.Provider.Duckdb.csproj", "{DE79C012-15B1-40EC-AD19-CBD7D489DB8E}"
EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FreeSql.Provider.TDengine", "Providers\FreeSql.Provider.TDengine\FreeSql.Provider.TDengine.csproj", "{329BA8B3-4139-4CCE-AFEC-4BE9B7BED317}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FreeSql.Tests.Provider.TDengine", "FreeSql.Tests\FreeSql.Tests.Provider.TDengine\FreeSql.Tests.Provider.TDengine.csproj", "{0C178F1C-0F65-47AA-A1DE-545CBF8543D1}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -789,6 +793,30 @@ Global
{DE79C012-15B1-40EC-AD19-CBD7D489DB8E}.Release|x64.Build.0 = Release|Any CPU
{DE79C012-15B1-40EC-AD19-CBD7D489DB8E}.Release|x86.ActiveCfg = Release|Any CPU
{DE79C012-15B1-40EC-AD19-CBD7D489DB8E}.Release|x86.Build.0 = Release|Any CPU
+ {329BA8B3-4139-4CCE-AFEC-4BE9B7BED317}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {329BA8B3-4139-4CCE-AFEC-4BE9B7BED317}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {329BA8B3-4139-4CCE-AFEC-4BE9B7BED317}.Debug|x64.ActiveCfg = Debug|Any CPU
+ {329BA8B3-4139-4CCE-AFEC-4BE9B7BED317}.Debug|x64.Build.0 = Debug|Any CPU
+ {329BA8B3-4139-4CCE-AFEC-4BE9B7BED317}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {329BA8B3-4139-4CCE-AFEC-4BE9B7BED317}.Debug|x86.Build.0 = Debug|Any CPU
+ {329BA8B3-4139-4CCE-AFEC-4BE9B7BED317}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {329BA8B3-4139-4CCE-AFEC-4BE9B7BED317}.Release|Any CPU.Build.0 = Release|Any CPU
+ {329BA8B3-4139-4CCE-AFEC-4BE9B7BED317}.Release|x64.ActiveCfg = Release|Any CPU
+ {329BA8B3-4139-4CCE-AFEC-4BE9B7BED317}.Release|x64.Build.0 = Release|Any CPU
+ {329BA8B3-4139-4CCE-AFEC-4BE9B7BED317}.Release|x86.ActiveCfg = Release|Any CPU
+ {329BA8B3-4139-4CCE-AFEC-4BE9B7BED317}.Release|x86.Build.0 = Release|Any CPU
+ {0C178F1C-0F65-47AA-A1DE-545CBF8543D1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {0C178F1C-0F65-47AA-A1DE-545CBF8543D1}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {0C178F1C-0F65-47AA-A1DE-545CBF8543D1}.Debug|x64.ActiveCfg = Debug|Any CPU
+ {0C178F1C-0F65-47AA-A1DE-545CBF8543D1}.Debug|x64.Build.0 = Debug|Any CPU
+ {0C178F1C-0F65-47AA-A1DE-545CBF8543D1}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {0C178F1C-0F65-47AA-A1DE-545CBF8543D1}.Debug|x86.Build.0 = Debug|Any CPU
+ {0C178F1C-0F65-47AA-A1DE-545CBF8543D1}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {0C178F1C-0F65-47AA-A1DE-545CBF8543D1}.Release|Any CPU.Build.0 = Release|Any CPU
+ {0C178F1C-0F65-47AA-A1DE-545CBF8543D1}.Release|x64.ActiveCfg = Release|Any CPU
+ {0C178F1C-0F65-47AA-A1DE-545CBF8543D1}.Release|x64.Build.0 = Release|Any CPU
+ {0C178F1C-0F65-47AA-A1DE-545CBF8543D1}.Release|x86.ActiveCfg = Release|Any CPU
+ {0C178F1C-0F65-47AA-A1DE-545CBF8543D1}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -831,6 +859,7 @@ Global
{8064870C-22EA-4A58-972D-DBD57D096D91} = {2A381C57-2697-427B-9F10-55DA11FD02E4}
{D9419896-BFB0-47C1-BEFD-A6C48394643B} = {4A92E8A6-9A6D-41A1-9CDA-DE10899648AA}
{4871434E-481D-4306-B6DD-73595C61A473} = {2A381C57-2697-427B-9F10-55DA11FD02E4}
+ {329BA8B3-4139-4CCE-AFEC-4BE9B7BED317} = {2A381C57-2697-427B-9F10-55DA11FD02E4}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
RESX_NeutralResourcesLanguage = en-US
diff --git a/FreeSql/DataType.cs b/FreeSql/DataType.cs
index 0409f7062..5fe899ee2 100644
--- a/FreeSql/DataType.cs
+++ b/FreeSql/DataType.cs
@@ -65,6 +65,8 @@ public enum DataType {
CustomOracle, CustomSqlServer, CustomMySql, CustomPostgreSQL,
- DuckDB
+ DuckDB,
+
+ TDengine
}
}
diff --git a/FreeSql/FreeSqlBuilder.cs b/FreeSql/FreeSqlBuilder.cs
index 6f5afd90a..90f626dcb 100644
--- a/FreeSql/FreeSqlBuilder.cs
+++ b/FreeSql/FreeSqlBuilder.cs
@@ -385,6 +385,11 @@ public IFreeSql Build()
if (type == null) throwNotFind("FreeSql.Provider.Duckdb.dll", "FreeSql.Duckdb.DuckdbProvider<>");
break;
+ case DataType.TDengine:
+ type = Type.GetType("FreeSql.TDengine.TDengineProvider`1,FreeSql.Provider.TDengine")?.MakeGenericType(typeof(TMark));
+ if (type == null) throwNotFind("FreeSql.Provider.TDengine.dll", "FreeSql.TDengine.TDengineProvider<>");
+ break;
+
default: throw new Exception(CoreErrorStrings.NotSpecified_UseConnectionString_UseConnectionFactory);
}
}
diff --git a/FreeSql/Internal/CommonProvider/InsertProvider.cs b/FreeSql/Internal/CommonProvider/InsertProvider.cs
index c099faa59..faca3c67f 100644
--- a/FreeSql/Internal/CommonProvider/InsertProvider.cs
+++ b/FreeSql/Internal/CommonProvider/InsertProvider.cs
@@ -609,10 +609,10 @@ public IInsert AsType(Type entityType)
public virtual string ToSql() => ToSqlValuesOrSelectUnionAllExtension103(true, null, null, false);
- public string ToSqlValuesOrSelectUnionAll(bool isValues = true) => ToSqlValuesOrSelectUnionAllExtension103(isValues, null, null, false);
+ public string ToSqlValuesOrSelectUnionAll(bool isValues = true, List ignoreColumn = null) => ToSqlValuesOrSelectUnionAllExtension103(isValues, null, null, false, ignoreColumn);
public string ToSqlValuesOrSelectUnionAllExtension101(bool isValues, Action