🌐 简体中文 | 繁體中文 | 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
dotnet add package NewLife.TDengine| 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.
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)}");
}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]);- 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.
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.
| 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 |
| 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) |
| 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 |
| 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 |
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 | MySql driver and helper layer built on the NewLife data stack. | |
| NewLife.TDengine | Pure managed TDengine ADO.NET driver with REST, WebSocket and native RPC transports, no native dependency. | |
| NewLife.Presto | Pure C# Presto/Trino ADO.NET driver with zero third-party dependencies and XCode ORM integration. | |
| Web & Distributed | ||
| NewLife.Cube | Rapid admin-platform framework: permissions, SSO, OAuth server and CRUD scaffolding. | |
| NewLife.Cube.React | Decoupled front-end sample for Cube: WebAPI backend with Swagger plus React, Vue and Blazor clients. | |
| 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. | |
| AI & Vision | ||
| NewLife.AI | Unified client for 46 LLM providers plus ChatAI, a ready-to-run web chat application. | |
| NewLife.Imaging | Pure managed imaging foundation: pixel model, codec contracts, drawing and metadata with zero native dependencies. | — |
| NewLife.Vision | Vision algorithms: OCR, barcodes, object detection and face recognition on top of NewLife.Imaging. | — |
| NewLife.ML | Tabular machine learning for .NET: turn database tables and Excel sheets into deployable prediction and classification models. | — |
| 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.Schneider | Schneider PLC communication driver built on Modbus TCP. | |
| NewLife.OPC | OPC client for industrial data access. | — |
| NewLife.BACnet | BACnet building-automation protocol stack. | |
| NewLife.LoRa | LoRaWAN low-power wide-area protocol for long-range IoT connectivity. | |
| 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. | |
| NewLife.Holiday | Chinese holiday and adjusted-workday identification library with built-in annual data and lunar festival support, fully offline. | |
| Tools & Products | ||
| CrazyCoder | Developer toolbox: network, serial port, crypto, regex, Modbus and MQTT. | |
| NewLife.UnitTest | Unit test extensions: test base classes, data-driven tests and dependency-injection helpers. | |
| 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, Office extensions, protocol drivers and more) are available under the NewLifeX organization and on newlifex.com.
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
MIT License. See LICENSE for details.
