LiteOrm is a lightweight, high-performance .NET ORM framework—the execution speed of a micro ORM with the ergonomics of a full ORM. Built for workloads that are performance sensitive but still need to handle complex SQL.
// 1. Define the entity; attributes are the mapping
[Table("Users")]
public class User
{
[Column("Id", IsPrimaryKey = true)]
public int Id { get; set; }
[Column("UserName")]
public string? UserName { get; set; }
[Column("Age")]
public int Age { get; set; }
}
// 2. One line to register, one line to query
builder.Host.RegisterLiteOrm();
var adults = await userService.SearchAsync(
u => u.Age >= 18 && u.UserName!.StartsWith("A"));
Generated SQL
SELECT [T0].[Id], [T0].[UserName], [T0].[Age]
FROM [Users] [T0]
WHERE [T0].[Age] >= @0 AND [T0].[UserName] LIKE @1
-- Fully parameterized: no SQL injectionThe execution speed of a micro ORM with the ergonomics of a full ORM—without hiding SQL, and without forcing you to hand-write it.
Performance close to raw Dapper and far ahead of EF Core. Bulk insert, update and association queries all lead the field, with the smallest allocation footprint.
Lambda, Expr and ExprString mix freely: strongly typed filters, dynamically built conditions, and hand-written SQL fragments at the DAO layer—each used where it fits.
Declare relations with [ForeignType] / [TableJoin]—no hand-written JOINs—and filter by a related table in one call with ExistsRelated.
The [Transaction] attribute brings AOP transaction management with nesting and rollback, leaving business code untouched.
SQL Server, MySQL, Oracle, PostgreSQL and SQLite, plus built-in support for the domestic databases DM, KingbaseES, GaussDB, OceanBase, TiDB and GreatDB.
The IArged interface routes sharded tables, while multiple data sources and read-only replicas work out of the box—covering the everyday needs of mid-size and large systems.
All three produce parameterized SQL. Lambda reads best, Expr suits dynamic composition, and ExprString is there for the DAO layer when you need precise control over the SQL.
// Write queries the way you write C#: strongly typed, highly readable
var users = await userService.SearchAsync(
u => u.Age >= 18 && u.UserName!.StartsWith("A"));
// Sorting + paging
var page = await userService.SearchAsync(
q => q.Where(u => u.Age >= 18)
.OrderByDescending(u => u.CreateTime)
.Skip(20).Take(10));// Compose conditions dynamically: ideal for query builders and admin filters
using static LiteOrm.Common.Expr;
var expr = (Prop("Age") >= 18)
& Prop("UserName").StartsWith("A");
var users = await userService.SearchAsync(expr);
// Conditions serialize to JSON, so they travel across layers or come straight from the client
string json = expr.ToJson();// Interpolated strings for hand-written SQL fragments, DAO layer only
using static LiteOrm.Common.Expr;
int minAge = 18;
var users = await userViewDAO.Search(
$"WHERE {Prop("Age")} > {minAge}")
.ToListAsync();
// Interpolated values are parameterized automatically: flexible and safeThe service layer exposes Lambda / Expr entry points plus SearchAs projection queries; the DAO layer additionally opens up ExprString, DataTable queries and other low-level capabilities. See the query overview.
.NET 10.0.11 · MySQL · BenchmarkDotNet MediumRun. Times below are for a 10,000-row batch.
| Framework | Insert | Update | Upsert | Association query |
|---|---|---|---|---|
| LiteOrm | 178.12 ms | 280.36 ms | 247.92 ms | 78.65 ms |
| Dapper | 266.28 ms | 355.83 ms | 327.69 ms | 98.68 ms |
| FreeSql | 332.71 ms | 570.89 ms | 257.39 ms | 101.45 ms |
| SqlSugar | 352.86 ms | 734.61 ms | 7042.44 ms | 179.25 ms |
| EF Core | 1837.48 ms | 1374.47 ms | 1538.52 ms | 162.80 ms |
Total allocations for insert / update / upsert / association query. The leanest allocator means lower GC pressure and steadier latency.
One entity mapping covers both mainstream and domestic databases. Domestic dialects are detected and matched with priority—no extra configuration.
Domestic and compatible builders extend the mainstream dialects and override only the differences. Older database versions can be supported through custom paging and a custom SqlBuilder. See the database compatibility notes.
From first steps to production, every scenario ships copy-paste-ready code. Bilingual and AI friendly.