explaingit

dotnetnext/sqlsugar

5,804C#Audience · developerComplexity · 3/5Setup · easy

TLDR

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.

Mindmap

mindmap
  root((SqlSugar))
    What it does
      ORM for .NET
      Replaces raw SQL
      Code-based data access
    Databases supported
      MySQL and SQL Server
      PostgreSQL and SQLite
      MongoDB and Oracle
      Chinese databases
    Features
      Pagination and joins
      Bulk inserts
      Multi-tenant support
      Subtable sharding
    Patterns
      Repository pattern
      Unit of Work
      Dependency injection
    Platforms
      .NET Framework
      .NET 9 and 10
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Things people build with this

USE CASE 1

Replace raw SQL queries in a .NET web app with C# code using SqlSugar to make the data layer easier to read and maintain.

USE CASE 2

Set up a multi-tenant application where each customer uses a separate database or table, using SqlSugar's built-in multi-tenant support.

USE CASE 3

Perform bulk inserts or updates of millions of rows efficiently using SqlSugar's large dataset handling features.

USE CASE 4

Build a paginated query API for a .NET web service using SqlSugar's built-in pagination and join query support.

Tech stack

C#.NETMySQLSQL ServerPostgreSQLSQLiteMongoDB

Getting it running

Difficulty · easy Time to first run · 30min

In plain English

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.

Copy-paste prompts

Prompt 1
I'm adding SqlSugar to a .NET 9 web API. Show me how to configure it with MySQL, define a model class, and write basic create, read, update, and delete operations.
Prompt 2
Using SqlSugar, help me write a paginated query that joins two tables and returns typed C# objects, ready to use in an ASP.NET Core controller.
Prompt 3
I need to insert 2 million rows into a SQL Server database quickly using SqlSugar. Show me how to use bulk insert and what settings to configure for best performance.
Prompt 4
Set up a multi-tenant SqlSugar configuration in .NET where each tenant gets their own database and show me how to switch databases at runtime based on tenant ID.
Prompt 5
Using SqlSugar with dependency injection in .NET, show me how to implement the Repository pattern and Unit of Work for a clean data access layer.
Open on GitHub → Explain another repo

← dotnetnext on gitmyhub — every repo by this author, as a profile.

Verify against the repo before relying on details.