TORM
On this page
TORM is a lightweight ORM for bulk writes and queries. Native database transport, cached entity metadata and column projection reduce repeated work, alongside mapping, CodeFirst, transactions, sharding and native upsert. OrmClient lives in TORM; database implementations ship as separate provider packages.
Install and run your first query
Install the core package and SQLite provider; no separate database service is required:
dotnet add package TORM
dotnet add package TORM.SqliteSQLite CRUD example · API reference · Bulk API selection
Performance at a glance
| Fixed workload | TORM result | Compared with EF Core + BulkExtensions |
|---|---|---|
| SQLite: insert 10,000 rows | 26.67 ms | 80.6% less managed allocation |
| SQL Server: selected-column update, 10,000 rows | 71.17 ms | 60.4% less time, 91.5% less allocation |
| MySQL: update all columns, 10,000 rows | 146.27 ms | 67.5% less time |
Medians from the 2026-11-22 fixed-workload short runs on .NET 10.0.15. Allocation is not peak memory. See performance and benchmarks for all four databases, comparison versions, workloads where TORM took longer, and API guidance.
Package selection
| Package | Access model |
|---|---|
TORM | Relational core, mapping attributes and query/write APIs |
TORM.Sqlite | SQLite |
TORM.MySql | MySQL / MariaDB |
TORM.SqlServer | SQL Server |
TORM.PostgreSql | PostgreSQL |
TORM.QuestDb | QuestDB REST SQL, schema and CSV import |
TORM.TaosData | TDengine Native / WebSocket |
TORM.IoTDB | Apache IoTDB Native API, explicit tree/table models |
TORM.Generators | Compile-time module initialization and registration |
DatabaseType contains MySql, SqlServer, Sqlite, PostgreSql and None. Time-series packages expose separate clients.
Reading path
| Task | Guide |
|---|---|
| Map entities and initialize schema | Mapping |
| Filter, project, page and stream records | Queries |
| Evaluate write time and query allocation | Performance and benchmarks |
| Insert, update, delete, upsert and bulk write | Writes |
| Aggregate and downsample values | Aggregation and time buckets |
| Commit, cancel and roll back transactions | Transactions |
| Route databases and shard tables | Multiple databases and sharding |
| Access QuestDB, TDengine or IoTDB | Time-series clients |
| Trim and publish Native AOT | AOT |
Dependencies and costs
Depends on TUtility.Core. Each OrmClient retains a connection and mutable state; use independent clients for concurrent work. Lists materialize all results. Use async enumeration or cursor paging for large results.