🌐 简体中文 | 繁體中文 | Español | Deutsch | 日本語 | Français | Português | Русский | 한국어 | العربية
NewLife.Presto is a pure C# ADO.NET driver for PrestoDB and Trino from the NewLife team. It speaks the official HTTP REST v1 client protocol, depends only on NewLife.Core with zero third-party dependencies, ships 33 runtime languages, targets net45 through net11, and is NativeAOT ready on net8.0+. PrestoDB and Trino share one package; Protocol=Trino (or TrinoHeaders=true) switches the request headers. Trino 466+ spooling is supported with uncompressed JSON segments.
Project status: implemented and tested — core ADO.NET driver plus read-only EF Core and EF6 providers, built as three NuGet packages shipped by one release pipeline. 561 core unit tests, EF provider tests and real Trino/PrestoDB integration pass; spooling covers uncompressed JSON segments and falls back to the direct protocol otherwise. See Doc/功能清单.md.
Contents: Quick Start · Why NewLife.Presto · Comparison & Benchmarks · Main Features · Platform Support · Localization · Documentation · Contributing · Ecosystem Map · Team · License
dotnet build NewLife.Presto.slnx -c Release
dotnet test UnitTest/UnitTest.csproj -c Release
dotnet run --project AotSmoke/AotSmoke.csproj -c Release -- --no-dbHost=localhost;Port=8080;Catalog=hive;Schema=default;User=test;Password=xxx
using NewLife.Presto;
using var conn = new PrestoConnection(
"Host=localhost;Port=8080;Catalog=hive;Schema=default;User=test;Password=xxx");
await conn.OpenAsync();
using var cmd = conn.CreateCommand();
cmd.CommandText = "select count(*) from tpch.tiny.nation where nationkey > @minKey";
cmd.Parameters.Add(new PrestoParameter("@minKey", 0));
var count = await cmd.ExecuteScalarAsync();// Entity Framework Core (read-only)
using Microsoft.EntityFrameworkCore;
using NewLife.Presto.EntityFrameworkCore;
var options = new DbContextOptionsBuilder<MyDbContext>()
.UsePresto("Host=localhost;Port=8080;Catalog=hive;Schema=default;User=test")
.Options;// Entity Framework 6 (read-only)
using System.Data.Entity;
using NewLife.Presto.EntityFramework;
DbConfiguration.SetConfiguration(new PrestoEFConfiguration());- One package for PrestoDB and Trino: the same protocol implementation, with
X-Presto-*/X-Trino-*headers selected by configuration. - XCode-first: factory, connection string aliases,
@parameters, metadata and capability boundaries are designed around XCode's Presto model. - Zero third-party dependencies: only
NewLife.Core; JSON, HTTP and logging come from the BCL or the NewLife stack. - Full framework and platform coverage:
net45~net11, Windows / Linux / macOS, x64 / arm64, plus observational LoongArch64 and musl builds. - 33 runtime languages: exceptions, logs and driver metadata are localized, with English as the source and fallback.
- NativeAOT ready: no runtime reflection in protocol or type codecs; NativeAOT smoke runs on every supported platform.
We ran this driver next to the other .NET ADO.NET Presto/Trino drivers and a raw HTTP v1 baseline in the same round: one process, identical SQL, median of three runs, against both Trino 476 and PrestoDB 0.300.
| Aspect | Finding |
|---|---|
| Query latency | Lowest or tied in the ADO group in every query scenario, from connect plus first query to 15,000-row scans and 16-column wide tables, with the largest gains on scans |
| Managed allocation | Lowest in every scenario and below the raw HTTP baseline: 9%–52% of the fastest competitor |
| 8-way concurrency | At or slightly below the raw HTTP baseline; slightly below the fastest competitor on Trino and slightly above it on PrestoDB |
| Environment | Local loopback, plaintext, no authentication; rankings are stable across rounds while absolute values vary by 20%–80% |
These are our own measurements from a single environment. Full tables, method and reproduction steps are in 性能测试; package versions and the per-feature matrix are in 竞品分析.
Trade-offs and limits
- Transactions, DDL, identity columns and stored procedures are out of scope for the driver; the EF Core and EF6 providers are read-only and reject writes and migrations.
- Spooling covers uncompressed JSON segments only; other encodings fall back to the direct protocol.
- UTF-8 streaming parsing requires
net6.0+;net45,net461andnetstandard2.xuse the dictionary path and allocate more. - Not yet benchmarked: AOT-published throughput, cells over 64 KB, and live JWT/OAuth2 gateways.
- Scope is ADO.NET plus read-only EF providers; there is no SDK-style query API.
Connection & Protocol (6 items)
| Feature | What it gives you |
|---|---|
| Connection string aliases | Host/Server/Data Source, Catalog/Database, Schema/Owner, and XCode-style keys |
| PrestoDB / Trino headers | Protocol=Presto by default; Protocol=Trino or TrinoHeaders=true for Trino 351+ |
| Session context | Catalog, schema, user, source, time zone, session properties and custom headers |
| Authentication | Basic, JWT/Bearer, OAuth2 client credentials and custom gateway headers, with secrets kept out of logs |
| TLS and proxies | Strict certificate validation by default; explicit trust switch for private CAs |
| Shared HTTP transport | Reuses HttpClient per endpoint, with proxy, compression and timeouts |
Query & Types (8 items)
| Feature | What it gives you |
|---|---|
| Statement lifecycle | POST /v1/statement, nextUri polling and completion detection |
| Forward-compatible states | Query states are strings, so new server states do not break parsing |
| Transient retry | 429/502/503/504 retry with Retry-After or exponential backoff |
@name parameters |
Client-side substitution that skips strings, identifiers and comments |
| Type fidelity | Boolean, integer, decimal, date/time, timestamp with time zone, UUID, IP and binary |
| Complex types | array/map/row default to raw strings; ComplexTypes=Structured returns object[] and dictionaries |
DbBatch (.NET 6+) |
Sequential batch commands with summed affected rows and cancellation propagated to the whole batch |
| Spooling (Trino 466+) | Spooling=true requests uncompressed JSON segments, downloads them from object storage and acknowledges them |
Integration & Diagnostics (6 items)
| Feature | What it gives you |
|---|---|
GetSchema |
MetaDataCollections, Tables, Columns, DataTypes |
| XCode integration | Default driver switch with legacy fallback; no transaction, DDL or auto-increment claims |
| Localization | 33 runtime languages, generated at compile time and AOT-safe |
| Diagnostics | Query id, error code, SQLState and timing preserved in exceptions and logs; read-only query/node diagnostics API |
| OpenTelemetry | ActivitySource("NewLife.Presto") on modern frameworks |
| Packaging | Strong naming, SourceLink, symbol package and README.nuget.md |
| Area | Supported |
|---|---|
| Operating systems | Windows, Linux (glibc and musl), macOS |
| Architectures | x64, arm64; LoongArch64 and riscv64 covered by observational builds |
| Target frameworks | net45, net461, netstandard2.0, netstandard2.1, net6.0, net8.0, net10.0, net11.0 |
| NativeAOT | net8.0+ with zero trim/AOT analyzer warnings; blocking smoke on win-x64, linux-x64, linux-arm64 |
| CI matrix | Windows, Linux x64, Linux arm64, musl containers, macOS and Windows arm64 (observational) |
| Scope | Coverage |
|---|---|
| Runtime messages | 33 languages including English; missing translations fall back to English |
| README | 11 languages generated from readme-languages.json |
| Metadata | Assembly title and description are English source strings and localized at display time |
Translation keys are the English source text. Add a new message in code, then add the same key to every locale file;
tools/check-locales.ps1 -RequireTranslatedenforces key, placeholder and translation completeness in CI.
- 需求文档 — requirements and scope
- 功能清单 — implementation/test/documentation status
- 架构设计 — components, protocol flow, type mapping, decisions
- 竞品分析 — reference projects, feature matrix, gaps
- 性能测试 — same-round benchmark against ADO competitors and a raw HTTP baseline
- Build:
dotnet build NewLife.Presto.slnx -c Release - Test:
dotnet test UnitTest/UnitTest.csproj -c Release - Localization:
pwsh -File tools/check-locales.ps1 -RequireTranslated - Follow NewLife C# conventions and keep every runtime message in the locale tables.
- Do not update
ChangeLog.mdor package release notes outside the release process.
NewLife is a layered ecosystem of independently versioned open-source projects. The map below is shared verbatim 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. | |
| 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.
Founded in 2002, the NewLife team has spent more than two decades on the .NET and IoT ecosystem, maintains nearly 100 open-source projects (34 of them core to this map), 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".
Open-source components have been downloaded 6.48M times from NuGet (ecosystem-wide, as of 2026-10).
Website: https://newlifex.com · Open source organization: https://github.com/NewLifeX
