NewLife.TDengine
1.0.2026.1122-beta0844
dotnet add package NewLife.TDengine --version 1.0.2026.1122-beta0844
NuGet\Install-Package NewLife.TDengine -Version 1.0.2026.1122-beta0844
<PackageReference Include="NewLife.TDengine" Version="1.0.2026.1122-beta0844" />
<PackageVersion Include="NewLife.TDengine" Version="1.0.2026.1122-beta0844" />
<PackageReference Include="NewLife.TDengine" />
paket add NewLife.TDengine --version 1.0.2026.1122-beta0844
#r "nuget: NewLife.TDengine, 1.0.2026.1122-beta0844"
#:package NewLife.TDengine@1.0.2026.1122-beta0844
#addin nuget:?package=NewLife.TDengine&version=1.0.2026.1122-beta0844&prerelease
#tool nuget:?package=NewLife.TDengine&version=1.0.2026.1122-beta0844&prerelease
NewLife.TDengine — Pure C# TDengine ADO.NET Driver
🌐 简体中文 | 繁體中文 | Español | Deutsch | 日本語 | Français | Português | Русский | 한국어 | العربية
NewLife.TDengine is a pure C# ADO.NET driver for TDengine from the NewLife team. The transport is selected from the server URI: http:// uses the REST API, ws:// uses WebSocket, and tcp:// uses the legacy native RPC protocol. REST and WebSocket go through taosAdapter (port 6041) and need no native library; native RPC targets legacy TDengine 2.x. The package is MIT licensed, targets net45 through net11.0, and integrates with the NewLife data stack through DbProviderFactory.
Contents: Quick Start · Connection Modes · Features · Data Types · Compatibility · Related Documentation · Ecosystem Map · Team · License
Quick Start
Install
dotnet add package NewLife.TDengine
Connection modes
| URI | Mode | Default port | Requires taosAdapter | Best for |
|---|---|---|---|---|
http://host |
REST | 6041 | Yes | Simple queries, management, cross-version access |
ws://host |
WebSocket | 6041 | Yes | Recommended: SQL plus binary result blocks |
tcp://host |
Native RPC 2.x | 6030 | No | Legacy TDengine 2.x (handshake and version only) |
If the URI has no scheme, tcp:// is assumed. https:// and wss:// default to port 443.
ADO.NET example
using NewLife.TDengine.Data;
using var conn = new TDengineConnection("Server=ws://127.0.0.1:6041;Database=test;Username=root;Password=taosdata");
conn.Open();
using var cmd = conn.CreateCommand();
cmd.CommandText = "SELECT ts, current FROM meters LIMIT 10";
using var reader = cmd.ExecuteReader();
while (reader.Read())
{
Console.WriteLine($"{reader.GetDateTime(0)} {reader.GetFloat(1)}");
}
TdClient example
using NewLife.TDengine;
using var client = new TdClient { Server = "http://127.0.0.1:6041", Database = "test" };
var result = await client.ExecuteAsync("SELECT SERVER_VERSION()");
Console.WriteLine(result.Rows[0][0]);
Why NewLife.TDengine
- Pure managed REST and WebSocket: no
taos.dll, no version-matched C client on the application host. - One API, three transports: switch between REST, WebSocket and legacy native RPC by changing only the URI scheme.
- Scheme auto-detection:
http://,ws://andtcp://are recognized automatically, with sensible default ports. - Actionable diagnostics: connection failures explicitly suggest starting taosAdapter and checking port 6041.
- NewLife ecosystem ready: implements
DbProviderFactory, so XCode and other ADO.NET consumers can use it directly. - MIT licensed: safe for commercial and domestic (信创) environments.
Performance and comparison
The figures below come from a same-machine benchmark against the official C# connector (TDengine.Connector, protocol=WebSocket), run with BenchmarkDotNet ShortRun on TDengine 3.3.6.13 in November 2026 (server in a local Linux VM). The official connector's Native mode is not part of this comparison. Results vary with hardware, network and data shape, so treat them as a reference; method and raw data are in the Performance Report.
| Scenario | NewLife.TDengine | Official C# connector |
|---|---|---|
| Insert 1 / 1,000 rows | 0.56 / 3.84 ms, 3.4 / 247 KB allocated | 0.61 / 4.35 ms, 10.1 / 321 KB allocated |
| 1,000-row line-protocol insert | 2.80 ms, 204 KB allocated | No equivalent ADO.NET entry |
| Scan 1M rows | 304 ms, 45.2 MB allocated | 327 ms, 169.7 MB allocated |
| Full-column read of 100k rows (entity mapping) | 49.9 ms, 7.65 MB allocated | 57.8 ms, 41.1 MB allocated |
| Point query, reused connection | 2.04 ms, 4.93 KB allocated | 1.80 ms, 15.79 KB allocated |
| Point query, connection per command | 2.32 ms, 12.8 KB allocated | 4.26 ms, 68.7 KB allocated |
| Point query, 8 concurrent connections | 4.5k ops/s, 4.81 MB allocated | 5.1k ops/s, 12.38 MB allocated |
Overall, writes, large scans, entity-style reads and per-command connections are equal or faster with substantially lower allocations. Single-connection point queries and concurrent point queries are about 11%–13% slower, though still allocate less memory. Aggregations and time-window queries are dominated by the server and are roughly equal.
The two drivers complement each other rather than compete:
| Topic | NewLife.TDengine | Official C# connector |
|---|---|---|
| Connection | REST, WebSocket (/ws, /rest/ws fallback), legacy 2.x RPC; fully managed |
Native (default) and WebSocket; Native mode requires the TDengine client library |
| Parameters | Client-side named and positional parameters | Server-side STMT2 parameter binding |
| Data adapter | DbDataAdapter.Fill and GetSchemaTable() |
The ADO.NET factory does not provide DbDataAdapter |
| Connection pooling | WebSocket session pool on by default, with failover, auto-reconnect and read/write timeouts | No ADO.NET-level pooling; each open performs a new handshake |
| Data subscription | TMQ not implemented | TMQ supported |
The official connector is the better choice for direct Native access to taosd (without taosAdapter), STMT2 binding or TMQ subscriptions. This driver is the better choice for fully managed deployment, HTTP-only environments and ADO.NET/ORM integration such as XCode and Cube. See the Competitor Analysis for the full capability matrix.
Features
| Feature | Description |
|---|---|
| ADO.NET | Connection / Command / DataReader / Parameter / Factory |
| REST transport | POST /rest/sql[/db], Basic and Bearer authentication |
| WebSocket transport | /ws native protocol with /rest/ws fallback; JSON queries and binary result blocks |
| Legacy native RPC | TDengine 2.x connect handshake and server version query |
| Parameters | Client-side substitution with escaping, timestamps and byte arrays |
| Type mapping | BOOL, integers, floats, BINARY, NCHAR, TIMESTAMP, JSON, VARBINARY, DECIMAL, BLOB, GEOMETRY |
| Async | OpenAsync / ExecuteReaderAsync / ExecuteScalarAsync / ExecuteNonQueryAsync |
| ORM integration | GetSchemaTable() and DbDataAdapter.Fill |
| Connection pooling | WebSocket session pool with Pooling, PoolIdleTimeout and ClearPool |
| Resilience | Multi-address failover, automatic reconnect, read/write timeouts, command timeout/cancel and compression |
| Schemaless writes | WriteSchemalessAsync with line protocol, Telnet and JSON |
| STMT2 prepare | TdPreparedStatement.PrepareAsync; binding execution waits for a server-side fix |
| Transactions | Not supported by TDengine; BeginTransaction throws NotSupportedException |
| Multi-language docs | 11 README languages plus a generated NuGet README |
Data Types
| TDengine | .NET |
|---|---|
| TIMESTAMP | DateTime |
| BOOL | Boolean |
| TINYINT / SMALLINT / INT / BIGINT | SByte / Int16 / Int32 / Int64 |
| TINYINT UNSIGNED / SMALLINT UNSIGNED / INT UNSIGNED / BIGINT UNSIGNED | Byte / UInt16 / UInt32 / UInt64 |
| FLOAT / DOUBLE | Single / Double |
| BINARY / VARBINARY / BLOB / GEOMETRY / JSON | Byte[] |
| NCHAR | String |
| DECIMAL | Decimal (string fallback when out of range) |
Compatibility
| Item | Support |
|---|---|
| .NET | net45 / net461 / netstandard2.0 / netstandard2.1 / net6.0 / net8.0 / net10.0 / net11.0 |
| TDengine 3.x | REST and WebSocket through taosAdapter |
| TDengine 2.x | Native RPC handshake and server version query (full SQL not implemented) |
| taosAdapter | Required for REST and WebSocket; included with the TDengine server package |
| Native dependencies | None for REST and WebSocket |
| Transactions | Not supported |
| Schemaless writes | Line protocol, Telnet and JSON through WebSocket |
| STMT2 | Prepare supported; binding execution waits for a taosAdapter 3.3.6.13 fix |
| TMQ | Not implemented |
| AOT / trimming | Smoke-tested with NativeAOT for REST and WebSocket |
Related Documentation
| Document | Description |
|---|---|
| Requirements | Vision, modules, scope and deferred items |
| Feature List | Three-dimensional status of implementation, tests and comments |
| Architecture | Layers, transports, sequence diagrams and design decisions |
| Competitor Analysis | Official and community TDengine connectors compared |
| Protocol Analysis | Native RPC 2.x, REST and WebSocket wire formats |
| Performance Report | Same-machine benchmark against the official C# connector |
| 简体中文 README | Chinese documentation, maintained with this English version |
Ecosystem Map
NewLife is a layered ecosystem of independently versioned open-source projects. The map below is shared by every NewLife repository; each project links to its repository and its primary NuGet package.
| Project | What it does | Downloads |
|---|---|---|
| Foundation | ||
| NewLife.Core | Logging, configuration, caching, networking, serialization, scheduling and APM tracing. | |
| NewLife.XCode | Data middleware: single tables at the tens-of-billions scale, automatic sharding, read-write splitting, 10+ databases. | |
| NewLife.Net | High-performance network library: 1.77M pps / 14.5 Gbps on a single machine (TCP 1KB, 2026-10), 4M long-lived TCP connections. | |
| NewLife.Remoting | Protocol communication and RPC framework for client/server applications and IoT devices. | |
| NewLife.Agent | Installs .NET applications as OS daemons: Windows services and Linux systemd. | |
| NewLife.Templates | dotnet new project templates for console, web, API, service, data and IoT projects. |
|
| Data & Messaging | ||
| NewLife.Redis | Redis client with microsecond latency, millions of ops/s and built-in message queues. | |
| NewLife.RocketMQ | Pure managed RocketMQ client for Apache RocketMQ and Alibaba Cloud Message Queue. | |
| NewLife.MQTT | MQTT client and server, including Alibaba Cloud IoT connectivity. | |
| NewLife.NovaDb | Hybrid database in C#: embedded or networked, relational, time-series, message queue and KV in one. | |
| NewLife.MySql | Pure C# MySQL ADO.NET driver with pipelined batch execution. | |
| NewLife.TDengine | Pure C# TDengine ADO.NET driver with REST, WebSocket and legacy native RPC transports. | |
| Web, AI & Distributed | ||
| NewLife.Cube | Rapid admin-platform framework: permissions, SSO, OAuth server and CRUD scaffolding. | |
| Stardust | Distributed service platform: node management, APM, configuration center, registry and release center. | |
| AntJob | Distributed task and real-time data scheduling platform with sharding, retries and backfill. | |
| NewLife.AI | Unified client for 46 LLM providers plus ChatAI, a ready-to-run web chat application. | |
| Industrial & IoT | ||
| NewLife.IoT | IoT standard library defining protocol contracts and device abstractions. | |
| NewLife.Modbus | Modbus TCP/RTU/ASCII implementation on top of NewLife.IoT. | |
| NewLife.Siemens | Siemens PLC protocol on top of NewLife.IoT. | |
| NewLife.Omron | Omron PLC protocol on top of NewLife.IoT. | |
| NewLife.Melsec | Mitsubishi Melsec PLC protocol on top of NewLife.IoT. | |
| NewLife.OPC | OPC client for industrial data access. | — |
| NewLife.BACnet | BACnet building-automation protocol stack. | |
| ZeroIoT | Lightweight open-source IoT platform with gateway and device management. | — |
| Vehicle Telematics | ||
| NewLife.JT808 | JT/T 808 vehicle positioning protocol: 70+ message bodies, 2011/2013/2019. | |
| NewLife.JT809 | JT/T 809 platform-to-platform protocol for transport authorities. | |
| NewLife.JT1078 | JT/T 1078 in-vehicle video: RTP parsing, FLV/fMP4 remuxing and live streaming. | |
| Domain Components | ||
| NewLife.Office | One package for Excel, Word, PPT, PDF and 15+ document formats. | |
| NewLife.Audio | Cross-platform audio: codecs, device I/O, DSP, containers and streaming. | |
| NewLife.Video | Video codecs, container formats, frame processing and streaming. | |
| NewLife.Map | Unified interface over Baidu, AMap, Tencent and Tianditu with geocoding and coordinate conversion. | |
| NewLife.IP | IPv4 geolocation with an offline memory-mapped database and an online API fallback. | |
| Tools & Products | ||
| CrazyCoder | Developer toolbox: network, serial port, crypto, regex, Modbus and MQTT. | |
| GitCandy | Self-hosted Git source code management system. | — |
| LuckyClover | Installs the matching .NET runtime automatically when launched from an older host. | — |
Badges show the primary package of each project; theme, extension and satellite packages are listed on their NuGet pages. The 30+ packages not listed here (FTP, LoRa, Office extensions, protocol drivers and more) are available under the NewLifeX organization and on newlifex.com.
Team
<img src="https://newlifex.com/logo.png" width="48" align="right" alt="NewLife" />
Founded in 2002, the NewLife team has spent more than two decades on the .NET and IoT ecosystem, maintains nearly 100 open-source projects, and delivers integrated software and hardware solutions for power, logistics, healthcare, industrial control and internet industries. We live by the motto "learning has no seniority — mastery earns respect".
Website: https://newlifex.com · Open source organization: https://github.com/NewLifeX
<details> <summary>WeChat Official Account: 智能大石头 (scan to follow)</summary>
</details>
License
MIT License. See LICENSE for details.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. net11.0 is compatible. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 is compatible. |
| .NET Framework | net45 is compatible. net451 was computed. net452 was computed. net46 was computed. net461 is compatible. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETFramework 4.5
- NewLife.Core (>= 12.0.2026.1121-beta0924)
-
.NETFramework 4.6.1
- NewLife.Core (>= 12.0.2026.1121-beta0924)
-
.NETStandard 2.0
- NewLife.Core (>= 12.0.2026.1121-beta0924)
-
.NETStandard 2.1
- NewLife.Core (>= 12.0.2026.1121-beta0924)
-
net10.0
- NewLife.Core (>= 12.0.2026.1121-beta0924)
-
net11.0
- NewLife.Core (>= 12.0.2026.1121-beta0924)
-
net6.0
- NewLife.Core (>= 12.0.2026.1121-beta0924)
-
net8.0
- NewLife.Core (>= 12.0.2026.1121-beta0924)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.0.2026.1122-beta0844 | 245 | 11/22/2026 |