SqlSugar
.Net aot ORM SqlServer ORM Mongodb ORM MySql 瀚高 Postgresql ORM DB2 Hana 高斯 Duckdb C# VB.NET Sqlite ORM Oracle ORM Mysql Orm 虚谷数据库 达梦 ORM 人大金仓 ORM 神通ORM C# ORM , C# ORM .NET ORM NET9 ORM .NET8 ORM ClickHouse ORM QuestDb ,TDengine ORM,OceanBase ORM,GaussDB ORM,Tidb ORM Object/Relational Mapping
An easy-to-use .NET ORM framework that lets you read and write data to many different databases using C# code instead of raw SQL, supporting MySQL, SQL Server, PostgreSQL, SQLite, MongoDB, and more.
SqlSugar is an open-source ORM framework for .NET applications. ORM stands for Object-Relational Mapper, which is a tool that lets developers read and write data to a database by writing regular code instead of raw database query language. Rather than typing out SQL statements by hand, you write C# code and SqlSugar translates it into the appropriate database queries automatically.
The framework supports a wide range of databases, including MySQL, SQL Server, SQLite, Oracle, PostgreSQL, MongoDB, and several databases commonly used in China such as DaMeng, OceanBase, and GaussDB. It also covers custom databases via ODBC. This breadth makes it possible to swap between database engines without rewriting your application's data access code.
SqlSugar is compatible with multiple .NET versions, from the older .NET Framework to the current .NET 9 and 10 releases. It is positioned as a low-code, easy-to-use alternative to more complex ORM tools, and it ships with features for common patterns like join queries, paginated results, multi-tenant database setups where different customers use separate databases or tables, and cross-database queries.
The framework includes support for handling large datasets, with documented approaches for bulk inserts and updates of millions of rows, as well as subtable sharding for very large tables. It also supports patterns common in structured applications, such as Unit of Work, Repository, and dependency injection context objects.
Documentation is available in both English and Chinese, with wiki pages covering each operation category including querying, inserting, updating, and deleting records. The project is maintained by the Fructose Big Data Technology team.
Where it fits
- Replace raw SQL queries in a .NET web app with C# code using SqlSugar to make the data layer easier to read and maintain.
- Set up a multi-tenant application where each customer uses a separate database or table, using SqlSugar's built-in multi-tenant support.
- Perform bulk inserts or updates of millions of rows efficiently using SqlSugar's large dataset handling features.
- Build a paginated query API for a .NET web service using SqlSugar's built-in pagination and join query support.