# newlife.xcode
**Repository Path**: mirrors_NewLifeX/newlife.xcode
## Basic Information
- **Project Name**: newlife.xcode
- **Description**: 数据中间件,支持MySQL、SQLite、SqlServer、Oracle、Postgresql、TDengine、达梦,重点在缓存、性能、分表、自动建表。
- **Primary Language**: Unknown
- **License**: MIT
- **Default Branch**: master
- **Homepage**: None
- **GVP Project**: No
## Statistics
- **Stars**: 0
- **Forks**: 0
- **Created**: 2023-02-25
- **Last Updated**: 2026-12-02
## Categories & Tags
**Categories**: Uncategorized
**Tags**: None
## README
# NewLife.XCode - Data Middleware / Super ORM





[](https://github.com/NewLifeX/NewLife.XCode/actions/workflows/test.yml)
[](Doc/多语言本地化.md)


[](https://github.com/NewLifeX/NewLife.XCode/graphs/contributors)
🌐 [简体中文](README.zh-CN.md) | [繁體中文](README.zh-TW.md) | [Español](README.es.md) | [Deutsch](README.de.md) | [日本語](README.ja.md) | [Français](README.fr.md) | [Português](README.pt.md) | [Русский](README.ru.md) | [한국어](README.ko.md) | [العربية](README.ar.md)
**NewLife.XCode** is a high-performance .NET data middleware focused on "CRUD + extreme performance + massive data". It includes multi-level caching, automatic modeling/migration, sharding, strongly-typed queries and cross-database migration. It supports MySQL / SQLite / SqlServer / Oracle / PostgreSQL / TDengine / InfluxDB / OpenTSDB / IoTDB / Prometheus / DaMeng / KingBase / HighGo / DB2 / ClickHouse / DuckDB / MongoDB / Hana (SAP HANA) / IRIS (InterSystems) / VastBase / Network virtual database / NovaDb / SonnetDB / Presto / Trino / Firebird / Snowflake / Vertica / SAP ASE / Teradata / YashanDB / MonetDB / Google Cloud Spanner and more; MySQL and PostgreSQL protocol-compatible engines (TiDB / Doris / StarRocks / openGauss / Redshift and others) reuse those providers. Production deployments reach tens of billions of rows per table, and query throughput can reach billions of QPS (with caching strategies).
Docs: https://newlifex.com/xcode Community QQ groups: 1600800 / 1600838
**Contents**: [Quick Start](#quick-start) · [Why XCode](#why-xcode) · [Main Features](#main-features) · [Ecosystem Map](#ecosystem-map) · [Documentation](#documentation) · [Contributing](#contributing) · [Team](#team) · [License](#license)
## Supported Databases
XCode reaches every database through a separate ADO.NET driver package. Install the package that matches your database; when a driver is missing, the error message also names the package to add. **33 communication-protocol providers** are built in — relational, embedded, time-series, columnar, document, federated and cloud data warehouses — covering **55 databases** in total: 33 dedicated providers plus **22 protocol-compatible databases** that reuse the MySQL, PostgreSQL or Prometheus provider.
| Database | Provider | NuGet driver package | Type |
| --- | --- | --- | --- |
| SQL Server | `SqlServer` | `System.Data.SqlClient` | Relational |
| MySQL / MariaDB | `MySql` | `NewLife.MySql` | Relational |
| PostgreSQL | `PostgreSQL` | `Npgsql` | Relational |
| Oracle | `Oracle` | `Oracle.ManagedDataAccess.Core` | Relational |
| SQLite | `SQLite` | `Microsoft.Data.Sqlite` | Embedded |
| Firebird | `Firebird` | `FirebirdSql.Data.FirebirdClient` | Relational |
| DB2 | `DB2` | `IBM.Data.DB2.Core` | Relational |
| SAP ASE (Sybase) | `Ase` | `AdoNetCore.AseClient` | Relational |
| DaMeng | `DaMeng` | `dmdbms.DmProvider` | Relational |
| Kingbase | `KingBase` | `Kdbndp` | Relational |
| HighGo | `HighGo` | `Nhgdb` | Relational |
| VastBase | `VastBase` | `Npgsql` | Relational |
| YashanDB | `YashanDB` | `Yashandb.Data.YashandbClient` | Relational |
| Hana | `Hana` | `Sap.Data.Hana` | In-memory |
| IRIS | `IRIS` | `InterSystems.Data.IRISClient` | Multi-model |
| ClickHouse | `ClickHouse` | `ClickHouse.Client` | Columnar |
| Vertica | `Vertica` | `Vertica.Data` | Columnar |
| MonetDB | `MonetDB` | `MonetDb.Mapi` | Columnar |
| DuckDB | `DuckDB` | `DuckDB.NET.Data` | Embedded OLAP |
| Snowflake | `Snowflake` | `Snowflake.Data` | Cloud DW |
| Teradata | `Teradata` | `Teradata.Client.Provider` | Cloud DW |
| Google Cloud Spanner | `Spanner` | `Google.Cloud.Spanner.Data` | Cloud |
| TDengine | `TDengine` | NewLife.TDengine | Time-series |
| InfluxDB | `InfluxDB` | Built-in | Time-series |
| OpenTSDB | `OpenTSDB` | Built-in | Time-series |
| IoTDB | `IoTDB` | Built-in | Time-series |
| Prometheus | `Prometheus` | Built-in | Time-series |
| MongoDB | `MongoDB` | `MongoDB.Driver` | Document |
| Presto | `Presto` | `NewLife.Presto` | Federated |
| Trino | `Trino` | `NewLife.Presto` | Federated |
| NovaDb | `NovaDb` | `NewLife.NovaDb` | Embedded / network |
| SonnetDB | `SonnetDB` | `SonnetDB` | Embedded / remote |
| Network | `Network` | Built-in | Virtual |
Protocol-compatible databases need no new provider; the provider name in the connection string selects the built-in alias:
| Database | Reused provider | Connection provider alias |
| --- | --- | --- |
| MariaDB | `MySql` | `mariadb` |
| TiDB | `MySql` | `tidb` |
| StarRocks | `MySql` | `starrocks` |
| Apache Doris | `MySql` | `doris` |
| OceanBase (MySQL mode) | `MySql` | `oceanbase` |
| SingleStore | `MySql` | `singlestore` |
| PolarDB | `MySql` | `polardb` |
| TDSQL | `MySql` | `tdsql` |
| GoldenDB | `MySql` | `goldendb` |
| GreatDB | `MySql` | `greatdb` |
| Databend | `MySql` | `databend` |
| openGauss | `PostgreSQL` | `opengauss` |
| GaussDB | `PostgreSQL` | `gaussdb` |
| Greenplum | `PostgreSQL` | `greenplum` |
| Amazon Redshift | `PostgreSQL` | `redshift` |
| CockroachDB | `PostgreSQL` | `cockroach` |
| YugabyteDB | `PostgreSQL` | `yugabyte` |
| TimescaleDB | `PostgreSQL` | `timescale` |
| QuestDB | `PostgreSQL` | `questdb` |
| GreptimeDB | `PostgreSQL` | `greptimedb` |
| CrateDB | `PostgreSQL` | `cratedb` |
| VictoriaMetrics | `Prometheus` | `victoriametrics` |
The same catalog is available at runtime through `DatabaseProducts.All`; `DatabaseProducts.ProtocolCount` and `DatabaseProducts.Count` return the two totals. The Access and SqlCe providers are retained but disabled.
## Quick Start
### Install
NuGet reference (any project):
```
dotnet add package NewLife.XCode
```
Or use the template scaffold:
```
dotnet new install NewLife.Templates
dotnet new xcode --name Demo.Data
cd Demo.Data
dotnet build
```
> The strong-name certificate is built in (newlife.snk); you can recompile for a private enterprise framework.
### Define the model (db.xml)
```xml
```
### Generate entity classes
- Download xcodetool.exe into the directory and double-click it, or run: `dotnet tool install xcodetool -g --prerelease` → `xcode db.xml`.
- Generates: 用户信息.cs (data class, overwritten) + 用户信息.Biz.cs (business class, not overwritten).
### CRUD
```csharp
using XCode;
var user = new UserInfo { UserName = "Zhang San", Password = "123456", Age = 18 };
user.Insert();
Console.WriteLine("Inserted a new record, user id: " + user.Id);
var u2 = UserInfo.FindById(user.Id);
u2.Age = 19;
u2.Update();
var list = UserInfo.FindAll(UserInfo._.Age > 10 & UserInfo._.UserName == "Zhang San");
UserInfo.FindById(user.Id)?.Delete();
```
> When using caches: fewer than 1000 entities → full-table cache; otherwise use regular queries / single-object cache.
## Why XCode
- **Homegrown and original**: fully developed in China with no third-party components, self-controlled and backed by long-term maintenance.
- **Simplicity**: 90% of business scenarios need only single-table entity operations, with no hand-written SQL.
- **Dapper compatible**: executes arbitrary SQL queries and maps them to any entity model; fully compatible with Dapper usage while adding caching, read/write splitting and tracing.
- **Extreme performance**: multi-level caching on the core path + batch optimization + in-memory joins; query speed can be far higher than raw SQL.
- **Massive data**: native paging and sharding strategies; production projects reach tens of billions of rows per table; paging algorithms adapt to multiple databases.
- **Stable and mature**: 20+ years of evolution and broad production validation; keeps compatibility with older .NET Framework versions (from net45).
- **Automatic migration**: model/entity is the schema; new fields are synchronized automatically on deployment, with no extra SQL scripts.
- **Distributed evolution**: native table-level / time / primary-key sharding strategies for smooth splitting and scaling.
- **Pluggable**: DAL abstraction + separated providers; custom database adapters are supported.
## Main Features
Modeling & Code Generation (5)
| Feature | Key Characteristics |
| --- | --- |
| XML model (Tables/Columns/Indexes) | The model is the single source of truth; attributes cover indexes, unique constraints, default values, descriptions and extended properties. |
| Code generator | `xcodetool` (global tool / exe) or the VS T4 template turns the XML model into entity classes. |
| Data class (`.cs`) | Overwritten on every generation; holds fields and basic queries. |
| Business class (`.Biz.cs`) | Not overwritten after the first generation; place custom logic here. |
| Auto-generated methods | Indexes and columns produce `FindByXxx` / `Search` helper methods and templates automatically. |
Entity Runtime & DAL (7)
| Component | Responsibility |
| --- | --- |
| `IEntity` / `Entity` | Rich domain model encapsulating fields, validation and lifecycle. |
| `IEntityOperate` | Static operation entry point (Find / FindAll / Query, etc.). |
| `EntityFactory` | Entity metadata cache factory. |
| `EntitySession` (`Meta.Session`) | Context of an entity on a specific connection/table, with session-level cache/statistics. |
| `Meta` | Entity static context (table schema, fields, caches, sharding policy, etc.). |
| `DAL` / `IDatabase` / `IDbSession` | Unified database access and metadata operations. |
| `CheckTables()` | Checks and synchronizes the schema on startup/first access, asynchronously or synchronously as needed. |
Query DSL (8)
| Capability | Key Characteristics |
| --- | --- |
| `IQueryable` LINQ (v12.0) | `Entity.Query` returns `IQueryable`, supporting standard LINQ operations such as `Where/OrderBy/Skip/Take/Count/First/ToList`. |
| `DAL.Select()` fluent queries (v12.1) | `DAL.Select()` returns `IQueryable` bound to the current connection, supporting fully chained fluent calls `WhereIf/Where/OrderBy/Skip/Take/Page/Count/FirstOrDefault/ToList`. |
| Navigation properties (v12.1) | `HasOne`/`HasMany` Fluent API configures navigation relationships; `Include` builds paths and batch-loads; `SelectBuilder` supports JOINs across navigation relationships. |
| `WhereIf` inline conditions | `Query.WhereIf(condition, predicate)` and `FindAllWhereIf` enable dynamic filtering. |
| `WhereExpression` | Chainable `&` / `\|` / `Contains` / `Between` / `Like` expression composition. |
| `Find` / `FindAll` / `Query` / `PageFindAll` | Query entry points, with paging built into `PageFindAll`. |
| `Pager` / `PageParameter` | Carries paging, sorting, `TotalCount` statistics and data-scope extensions. |
| Window functions (v12.0) | `SelectBuilder.Window` + `WindowFunction` supports ROW_NUMBER/RANK/DENSE_RANK and aggregate window functions. |
Multi-level Cache System (6)
Designed for read-heavy, write-light workloads:
| Cache | Key Characteristics |
| --- | --- |
| `Meta.Count` | Fast row-count cache (uses system indexes when >1000; SQLite uses Max(identity) plus asynchronous exact compensation). |
| `EntityCache` (`Meta.Cache.Entities`) | Full-table cache (recommended for small tables <1000 rows; forbidden above 10000 rows). |
| `SingleCache` (`Meta.SingleCache[key]`) | Dictionary-level single-object cache by primary/alternate key; suitable for frequent point lookups such as users. |
| Expiration policy | 60s by default. Expired reads return stale data immediately + refresh asynchronously. Writes invalidate/update caches immediately. |
| Transaction awareness | Inside a transaction, modifications accumulate; caches are cleared or rolled back uniformly after commit/rollback. |
| Second-level cache (v12.0) | `CacheInvalidator.Provider` injects Redis and coordinates entity cache invalidation across processes through a version mechanism. |
Reverse Engineering & Migration (3)
| Capability | Key Characteristics |
| --- | --- |
| Schema reverse engineering | Creates/modifies table schemas and indexes from entities in reverse, keeping them consistent automatically. |
| Per-entity migration policy | Table-level `Migration` configuration (model `Table` attribute / `[BindTable]` / `TableItem` startup override) controls the reverse-engineering strategy per entity (Off / ReadOnly / On / Full). |
| Model extraction & cross-database migration | Supports model extraction from any database + cross-database data migration (with the DataMigration companion tool). |
Sharding (ShardPolicy) (3)
| Capability | Key Characteristics |
| --- | --- |
| `ShardPolicy` abstraction | `TimeShardPolicy` example: table name Table_yyyyMMdd by date. |
| Transparent routing | Business code still calls Find / Insert / Update and does not care about the actual table name. |
| Custom strategies | Customizable primary-key hash / time / range strategies. |
Transactions & Cache Consistency (3)
| Scenario | Key Characteristics |
| --- | --- |
| Non-transactional writes | Writes immediately expire related caches and rebuild them asynchronously, while attempting to update in-memory objects directly for read/write consistency. |
| Commit | Inside a transaction, full-table caches are not cleared; only hit objects are changed locally; after commit they are cleared or refreshed uniformly. |
| Rollback | On rollback, changes made inside the transaction are reverted. |
Performance Optimizations (6)
| Technique | Key Characteristics |
| --- | --- |
| Multi-level caching | Keeps hot queries off the database. |
| Batch writes | Merges multi-field and multi-record operations (internal optimization). |
| Paging algorithms | Chooses the optimal strategy per database/version. |
| Lazy/asynchronous | Row counts, model checks and cache refreshes can all run asynchronously. |
| Reflection cache / delegate acceleration | Pre-warms entity property accessors. |
| In-memory association | Caches the main table first, then performs "pseudo joins" in memory. |
Data Scope & Multi-Tenancy (7)
| Capability | Key Characteristics |
| --- | --- |
| Data scope | Row-level data access control supporting five scopes: "All / Department and sub-departments / Department / Self only / Custom". |
| Scope wiring | `DataScopeContext` + `DataScopeFilter` apply query filters, default ownership on insert, and validation on update/delete; the `DataScopeInterceptor` compatibility alias maps to the filter pipeline. |
| Entity opt-in | Entities implement `IUserScope` / `IDepartmentScope` / `IDataScope`; department managers are automatically included in the visible scope, and one's own data is always accessible. |
| Multi-tenancy | After an entity implements `ITenantScope`, `TenantFilter` appends tenant filters on queries, validates/fills the tenant identifier on writes, and covers batch and condition writes; cache reads bypass filters; the `TenantInterceptor` compatibility alias maps to the filter pipeline, and EntityBuilder automatically implements `ITenantScope` for business classes that contain a `TenantId` column. |
| Operation filters | `IEntityFilter` + `EntityContext` (v12.4) provide before/after interception for single, batch and query operations, with `Order` priority, `EntityFilterScope` bypass and conditional write filtering. |
| Plugin boundary | Core keeps CRUD, caching, sharding and batch orchestration; `IEntityFilter` (entity), `IDbCommandFilter` (command) and `IDatabase` (provider) are explicit extension contracts. |
| Details | See `Doc/实体过滤器(IEntityFilter).md`, `Doc/插件化架构.md`, `Doc/数据权限.md` and `Doc/权限管理.md` for details. |
Multi-database Configuration (4)
| Capability | Key Characteristics |
| --- | --- |
| SQLite by default | SQLite is the default for development (zero configuration). |
| Connection settings | At deployment, configure `XCode_{ConnName}` in the configuration file or environment variables. |
| Provider identifier | The connection string must include the provider identifier (for example: `provider=MySql;server=...;user=...;******;database=...;`). |
| Multiple connections | Multiple database connection names (ConnName) can be used together in the same process. |
### Usage examples
#### Dynamic conditions and paging
```csharp
public static IList Search(String name, Int32 age, Pager p)
{
var exp = new WhereExpression();
if (!name.IsNullOrEmpty()) exp &= UserInfo._.UserName == name;
if (age > 0) exp &= UserInfo._.Age == age;
return UserInfo.FindAll(exp, p);
}
```
#### Updating specified fields (bypasses cache; not recommended for regular use)
```csharp
UserInfo.Update(UserInfo._.UserName == "Li Si" & UserInfo._.Age == 18, UserInfo._.Id == 1);
```
#### Custom sorting and column projection
```csharp
var list = UserInfo.FindAll(UserInfo._.Age > 10, " Age DESC,Id ASC",
string.Join(",", UserInfo._.UserName, UserInfo._.Age), 0, 20);
```
#### Indexes and generated methods
Add indexes to the model:
```xml
```
After regeneration, `FindByUserName`, combined-condition helper methods / Search templates appear automatically.
Entity cache strategy: when `Meta.Session.Count < 1000`, use in-memory collection lookups; otherwise go to the database or single-object cache.
```csharp
public static UserInfo FindByUserName(String userName)
{
if (userName.IsNullOrEmpty()) return null;
if (Meta.Session.Count < 1000) return Meta.Cache.Find(e => e.UserName.EqualIgnoreCase(userName));
return Find(_.UserName == userName);
}
```
#### Sharding example
```csharp
Meta.ShardPolicy = new TimeShardPolicy(nameof(UserInfo.Id), Meta.Factory)
{
ConnPolicy = "{0}", // customizable database name policy
TablePolicy = "{0}_{1:yyyyMMdd}", // table name template
Step = TimeSpan.FromDays(1)
};
```
All other code such as Insert / Query stays unchanged and is routed to the corresponding date table automatically.
#### Original examples (retained)
Original CRUD and complex query examples
##### Create, read, update, delete
```csharp
var user = new UserInfo();
user.UserName = "Zhang San";
user.Password = "123456";
user.Age = 18;
user.Insert();
Console.WriteLine("Inserted a new record, user id: " + user.Id);
var u = UserInfo.FindById(1);
u.UserName = "Zhang San";
u.Password = "123456";
u.Age = 19;
u.Update();
u = UserInfo.FindById(1);
Console.WriteLine($"User ID={u.Id} age updated to: {u.Age}");
```
##### Complex query
```csharp
var list = UserInfo.FindAll(UserInfo._.UserName == "Zhang San" & UserInfo._.Age == 19, UserInfo._.UserName.Desc(), string.Join(",", UserInfo._.UserName, UserInfo._.Age), 0, 0);
```
### Benchmarks
| Capability | Metric (typical environment) | Notes |
| ---- | ---------------- | ---- |
| Single-machine Insert | up to ~890k TPS | batch / cache + SQLite / RAM disk combination tests |
| Single-machine Query | up to ~1.8 billion QPS | small tables + entity cache / single-object cache scenarios |
| Data volume per table | tens of billions in production | paging + sharding strategies |
> Actual performance depends on database type / hardware / sharding strategy / cache hit rate.
### FAQ
- Why is the first Count fast? `Meta.Count` uses system indexes; SQLite may first take the identity maximum and then refine asynchronously.
- How soon is the cache consistent after an update? Writes in the current process are reflected immediately; across processes, wait for cache expiration or use an active invalidation strategy.
- Can automatic migration be disabled? Set `Migration=Off` (globally or per table), or use ReadOnly/On/Full as needed.
- Complex multi-table queries? Multiple single-table queries + in-memory association are recommended (faster with cache hits and clearer structure).
## Ecosystem Map
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](https://github.com/NewLifeX/X) | Logging, configuration, caching, networking, serialization, scheduling and APM tracing. | [](https://www.nuget.org/packages/NewLife.Core) |
| [NewLife.XCode](https://github.com/NewLifeX/NewLife.XCode) | Data middleware: single tables at the tens-of-billions scale, automatic sharding, read-write splitting, 10+ databases. | [](https://www.nuget.org/packages/NewLife.XCode) |
| [NewLife.Net](https://github.com/NewLifeX/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. | [](https://www.nuget.org/packages/NewLife.Net) |
| [NewLife.Remoting](https://github.com/NewLifeX/NewLife.Remoting) | Protocol communication and RPC framework for client/server applications and IoT devices. | [](https://www.nuget.org/packages/NewLife.Remoting) |
| [NewLife.Agent](https://github.com/NewLifeX/NewLife.Agent) | Installs .NET applications as OS daemons: Windows services and Linux systemd. | [](https://www.nuget.org/packages/NewLife.Agent) |
| [NewLife.Templates](https://github.com/NewLifeX/NewLife.Zero) | `dotnet new` project templates for console, web, API, service, data and IoT projects. | [](https://www.nuget.org/packages/NewLife.Templates) |
| **Data & Messaging** | | |
| [NewLife.Redis](https://github.com/NewLifeX/NewLife.Redis) | Redis client with microsecond latency, millions of ops/s and built-in message queues. | [](https://www.nuget.org/packages/NewLife.Redis) |
| [NewLife.RocketMQ](https://github.com/NewLifeX/NewLife.RocketMQ) | Pure managed RocketMQ client for Apache RocketMQ and Alibaba Cloud Message Queue. | [](https://www.nuget.org/packages/NewLife.RocketMQ) |
| [NewLife.MQTT](https://github.com/NewLifeX/NewLife.MQTT) | MQTT client and server, including Alibaba Cloud IoT connectivity. | [](https://www.nuget.org/packages/NewLife.MQTT) |
| [NewLife.NovaDb](https://github.com/NewLifeX/NewLife.NovaDb) | Hybrid database in C#: embedded or networked, relational, time-series, message queue and KV in one. | [](https://www.nuget.org/packages/NewLife.NovaDb) |
| [NewLife.MySql](https://github.com/NewLifeX/NewLife.MySql) | MySql driver and helper layer built on the NewLife data stack. | [](https://www.nuget.org/packages/NewLife.MySql) |
| [NewLife.TDengine](https://github.com/NewLifeX/NewLife.TDengine) | Pure managed TDengine ADO.NET driver with REST, WebSocket and native RPC transports, no native dependency. | [](https://www.nuget.org/packages/NewLife.TDengine) |
| [NewLife.Presto](https://github.com/NewLifeX/NewLife.Presto) | Pure C# Presto/Trino ADO.NET driver with zero third-party dependencies and XCode ORM integration. | [](https://www.nuget.org/packages/NewLife.Presto) |
| **Web & Distributed** | | |
| [NewLife.Cube](https://github.com/NewLifeX/NewLife.Cube) | Rapid admin-platform framework: permissions, SSO, OAuth server and CRUD scaffolding. | [](https://www.nuget.org/packages/NewLife.Cube) |
| [NewLife.Cube.React](https://github.com/NewLifeX/NewLife.Cube.React) | Decoupled front-end sample for Cube: WebAPI backend with Swagger plus React, Vue and Blazor clients. | [](https://www.nuget.org/packages/NewLife.Cube.React) |
| [Stardust](https://github.com/NewLifeX/Stardust) | Distributed service platform: node management, APM, configuration center, registry and release center. | [](https://www.nuget.org/packages/NewLife.Stardust) |
| [AntJob](https://github.com/NewLifeX/AntJob) | Distributed task and real-time data scheduling platform with sharding, retries and backfill. | [](https://www.nuget.org/packages/NewLife.AntJob) |
| **AI & Vision** | | |
| [NewLife.AI](https://github.com/NewLifeX/NewLife.AI) | Unified client for 46 LLM providers plus ChatAI, a ready-to-run web chat application. | [](https://www.nuget.org/packages/NewLife.AI) |
| [NewLife.Imaging](https://github.com/NewLifeX/NewLife.Imaging) | Pure managed imaging foundation: pixel model, codec contracts, drawing and metadata with zero native dependencies. | — |
| [NewLife.Vision](https://github.com/NewLifeX/NewLife.Vision) | Vision algorithms: OCR, barcodes, object detection and face recognition on top of NewLife.Imaging. | — |
| [NewLife.ML](https://github.com/NewLifeX/NewLife.ML) | Tabular machine learning for .NET: turn database tables and Excel sheets into deployable prediction and classification models. | — |
| **Industrial & IoT** | | |
| [NewLife.IoT](https://github.com/NewLifeX/NewLife.IoT) | IoT standard library defining protocol contracts and device abstractions. | [](https://www.nuget.org/packages/NewLife.IoT) |
| [NewLife.Modbus](https://github.com/NewLifeX/NewLife.Modbus) | Modbus TCP/RTU/ASCII implementation on top of NewLife.IoT. | [](https://www.nuget.org/packages/NewLife.Modbus) |
| [NewLife.Siemens](https://github.com/NewLifeX/NewLife.Siemens) | Siemens PLC protocol on top of NewLife.IoT. | [](https://www.nuget.org/packages/NewLife.Siemens) |
| [NewLife.Omron](https://github.com/NewLifeX/NewLife.Omron) | Omron PLC protocol on top of NewLife.IoT. | [](https://www.nuget.org/packages/NewLife.Omron) |
| [NewLife.Melsec](https://github.com/NewLifeX/NewLife.Melsec) | Mitsubishi Melsec PLC protocol on top of NewLife.IoT. | [](https://www.nuget.org/packages/NewLife.Melsec) |
| [NewLife.Schneider](https://github.com/NewLifeX/NewLife.Schneider) | Schneider PLC communication driver built on Modbus TCP. | [](https://www.nuget.org/packages/NewLife.Schneider) |
| [NewLife.OPC](https://github.com/NewLifeX/NewLife.OPC) | OPC client for industrial data access. | — |
| [NewLife.BACnet](https://github.com/NewLifeX/NewLife.BACnet) | BACnet building-automation protocol stack. | [](https://www.nuget.org/packages/NewLife.BACnet) |
| [NewLife.LoRa](https://github.com/NewLifeX/NewLife.LoRa) | LoRaWAN low-power wide-area protocol for long-range IoT connectivity. | [](https://www.nuget.org/packages/NewLife.LoRa) |
| [ZeroIoT](https://github.com/NewLifeX/ZeroIoT) | Lightweight open-source IoT platform with gateway and device management. | — |
| **Vehicle Telematics** | | |
| [NewLife.JT808](https://github.com/NewLifeX/NewLife.JT808) | JT/T 808 vehicle positioning protocol: 70+ message bodies, 2011/2013/2019. | [](https://www.nuget.org/packages/NewLife.JT808) |
| [NewLife.JT809](https://github.com/NewLifeX/NewLife.JT809) | JT/T 809 platform-to-platform protocol for transport authorities. | [](https://www.nuget.org/packages/NewLife.JT809) |
| [NewLife.JT1078](https://github.com/NewLifeX/NewLife.JT1078) | JT/T 1078 in-vehicle video: RTP parsing, FLV/fMP4 remuxing and live streaming. | [](https://www.nuget.org/packages/NewLife.JT1078) |
| **Domain Components** | | |
| [NewLife.Office](https://github.com/NewLifeX/NewLife.Office) | One package for Excel, Word, PPT, PDF and 15+ document formats. | [](https://www.nuget.org/packages/NewLife.Office) |
| [NewLife.Audio](https://github.com/NewLifeX/NewLife.Audio) | Cross-platform audio: codecs, device I/O, DSP, containers and streaming. | [](https://www.nuget.org/packages/NewLife.Audio) |
| [NewLife.Video](https://github.com/NewLifeX/NewLife.Video) | Video codecs, container formats, frame processing and streaming. | [](https://www.nuget.org/packages/NewLife.Video) |
| [NewLife.Map](https://github.com/NewLifeX/NewLife.Map) | Unified interface over Baidu, AMap, Tencent and Tianditu with geocoding and coordinate conversion. | [](https://www.nuget.org/packages/NewLife.Map) |
| [NewLife.IP](https://github.com/NewLifeX/NewLife.IP) | IPv4 geolocation with an offline memory-mapped database and an online API fallback. | [](https://www.nuget.org/packages/NewLife.IP) |
| [NewLife.Holiday](https://github.com/NewLifeX/NewLife.Holiday) | Chinese holiday and adjusted-workday identification library with built-in annual data and lunar festival support, fully offline. | [](https://www.nuget.org/packages/NewLife.Holiday) |
| **Tools & Products** | | |
| [CrazyCoder](https://github.com/NewLifeX/XCoder) | Developer toolbox: network, serial port, crypto, regex, Modbus and MQTT. | [](https://www.nuget.org/packages/NewLife.XCoder) |
| [NewLife.UnitTest](https://github.com/NewLifeX/NewLife.UnitTest) | Unit test extensions: test base classes, data-driven tests and dependency-injection helpers. | [](https://www.nuget.org/packages/NewLife.UnitTest) |
| [GitCandy](https://github.com/NewLifeX/GitCandy) | Self-hosted Git source code management system. | — |
| [LuckyClover](https://github.com/NewLifeX/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](https://github.com/NewLifeX) and on [newlifex.com](https://newlifex.com).
## Documentation
- [XCode documentation navigation](Doc/XCode文档导航.md): complete document index grouped by module
- [XCode user manual](Doc/XCode使用手册.md): end-to-end usage walkthrough
- [Architecture design](Doc/架构设计.md): layering, components and key design decisions
- [Database support matrix](Doc/数据库支持矩阵.md): supported engines, ADO.NET drivers, capability boundaries
- [Multi-language localization](Doc/多语言本地化.md): message model, language tables and runtime overrides
- Online documentation: https://newlifex.com/xcode
- [ChangeLog.md](ChangeLog.md): version history
## Contributing
### Build and test
```
dotnet restore
dotnet build -c Release
dotnet test XUnitTest.XCode -c Release
```
- Add cases under `XUnitTest.XCode`; performance-related suggestions should include benchmarks or explanations.
- Follow the repository conventions (strong naming, multi-TFM, XML comments, conditional compilation).
- Public API changes require a migration strategy (Obsolete → removal).
### Release
Push a `v`-prefixed tag (for example `v2026.1018`) to trigger `.github/workflows/publish.yml`. The workflow packs XCode, XCodeTool and the provider packages (`XCode.MySql`, `XCode.SQLite`, `XCode.SqlServer`, `XCode.Oracle`, `XCode.PostgreSQL`, `XCode.Presto`, `XCode.TDengine`, `XCode.DaMeng`, `XCode.DB2`, `XCode.KingBase`, `XCode.HighGo`, `XCode.SonnetDB`) and pushes them to NuGet.org and GitHub Packages.
### Feedback
- Issues / PRs are welcome: performance optimization / new database providers / documentation improvements.
- Before submitting, make sure `dotnet build` and the relevant unit tests pass; follow the repository conventions for code style and commit messages.
- Report bugs and suggestions via [Issue](https://github.com/NewLifeX/NewLife.XCode/issues); Stars and PRs are welcome.
## Team
Founded in 2002, the NewLife team has spent more than two decades on the .NET and IoT ecosystem, maintains nearly 100 open-source projects (44 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
WeChat Official Account: 智能大石头 (scan to follow)

## License
MIT, fully open. Commercial use / modification / redistribution are allowed (you may replace "NewLife" with your enterprise brand for private deployments). The strong-name certificate `newlife.snk` is built in.
> If this project helps you, please Star it, share it with your team, or send improvement suggestions via Issue/PR.