1024programmer Asp.Net .NET mainstream ORM function introduction encyclopedia latest

.NET mainstream ORM function introduction encyclopedia latest

.NET mainstream ORM function introduction complete latest

.NET mainstream ORM

The following are the 3 most commonly used ORMs for .NET. They come from the voting results of public accounts. The data is relatively real and reliable. You can also search the public accounts to continue voting

Voting results in November 2023

Test project Release time WeChat public account voting (chasing time and light) Difficulty of use Function Performance
SqlSugar orm 2014 26% 491 votes Moderate Full Medium High
EFCore orm 2016 36% 663 votes Difficult Full Medium High
Dapper orm 2013 23% 374 votes Simple Less High
Other sums 14%

1. Introduction to SqlSugar ORM

It is an old .NET open source multi-library architecture ORM framework (EF Core single database architecture), maintained and updated by the Fructose big data technology team. It is the easiest to use .NET ORM framework out of the box. The ecosystem is rich. Currently, the open source ecosystem is second only to EF Core, but SqlSugar is preferred among projects or products that require multi-library compatibility

1.1 ORM Getting Started Example

      //Create a database object (the usage is the same as EF Dapppper to ensure thread safety through new)
      SqlSugarClient Db= new SqlSugarClient(new ConnectionConfig(){
            ConnectionString = "Connector string",
            DbType = DbType.SqlServer,
            IsAutoCloseConnection = true});
      
      //Create table
      //db.CodeFirst.InitTables(); See more about document migration
            
      //Query all of the table
      var list = db.Queryable().ToList();
      
      //insert
      db.Insertable(new Student() { SchoolId = 1, Name = "jack" }).ExecuteCommand();
      
      //renew
      db.Updateable(new Student() { Id = 1, SchoolId = 2, Name = "jack2" }).ExecuteCommand();
      
      //delete
      db.Deleteable().Where(it => it.Id == 1).ExecuteCommand();
 
    
 
        
 
     //The entity has the same structure as the database
     public class Student
     {
      //The data is self-increasing and needs to be added with IsIdentity
      //The database is the primary key and needs to be added with IsPrimaryKey
      //Note: Two attributes must be completely consistent with the database
      [SugarColumn(IsPrimaryKey = true, IsIdentity = true)]
      public int Id { get; set; }
      public int? SchoolId { get; set; }
      public string Name { get; set; }
      }
 Click and drag to move
 

 

1.2 SqlSugar ORM out of the box (supports AOT)

1. An ORM that can truly implement zero Sql and has a super query system: navigation query, joint table query, union query, subquery, report query, etc.

2. Supports .NET million-level [big data] writing and updating, sub-tables and billions of queries and statistics, etc. Has mature solutions

3. Support SAAS complete application cross-database query, auditing, tenant sub-database, tenant sub-table and tenant data isolation

4. Support [low code] + workflow (dynamic class creation, dynamic table creation, non-entity multi-database compatible with CRUD, JSON TO SQL, custom XML, etc.)

5. .NET ORM with the coolest syntax, beautiful expressions, warehousing, UnitOfWork, DbContext, AOP

6. Supports 3 development modes: DbFirst, CodeFirst (no command migration) and [WebFirst]

7. Simple and easy to use, complete functions, high performance, lightweight, complete services, official website tutorial documents, professional technical support 18 hours a day

1.3 SqlSugar database support

Relational database

MySql, SqlServer, Sqlite, Oracle, postgresql, Dameng,

Renmin University Jincang (domestic recommendation), massive database Vastbase, Shentong database, Hangao, Access,

OceanBase MySqlConnector, Huawei GaussDB, Nanda General GBase, MariaDB, Tidb, Odbc, Percona Server, Amazon Aurora, Azure Database for MySQL, PolarDB

Google Cloud SQL for MySQL, kunDB, TDSQL, GoldenDB,

Custom database

Time series database

TDengine (supports clustering, has the disadvantage of not supporting updates, weak syntax and few supported things)

QuestDb (suitable for billions of data analysis, fuzzy query, suitable for single machine, powerful syntax, automatic table storage,…The point does not support deletion)

Column storage Clickhouse (applicable to business intelligence (BI), disadvantages must be the same as the library, does not support transactions)
Coming soon

Mongodb (mongodb.entities) extended to January 24

Sybase, hana, FireBird, InfluxDB

litedb、

SqlSugar Feature 1: Super simple

You can have the best experience without using any design patterns or any framework. SqlSugar provides a nanny-like service and can be used directly without learning

framework, various default values ​​​​are optimal configurations, just read the documentation for what to use.

SqlSugar Feature 2: Product Essentials

1. Low code support: string to exp, exp to string, exp to sql, List to sql, Json to sql, List to Class

2. One set of code can support all mainstream databases (including domestic databases), and the cost is much lower than EF Core. Basically every database in EF Core needs to be written manually

Compatible code . For example: creating tables, creating views, obtaining table structures, obtaining data types, query functions, indexes, modifying tables, etc., SqlSugar only requires one

One set of code can support multiple databases. Supports multi-database table creation, multi-database modification tables, multi-database indexes, multi-database transactions, multi-database queries, cross-database queries, and multi-database coexistence.

Multiple library switching and so on.

Supplement: Supports over 100 Sql functions

SqlSugar Feature 3: High-performance solution

1. SqlSugar can generate ideal Sql and stand out. On the contrary, EF Core has limited ability to adjust the generated SQL and may be subject to some restrictions and constraints. SqlSugar’s advantages in complex queries make it a more powerful and efficient choice.

2. SqlSugar provides comprehensive high-performance solutions, including big data writing, big data navigation query, big data update, big data table sharding, big data deletion, big data insertion or update, big data import and verification and other functions. In addition, it also supports secondary cache, read-write separation, timing library and other functions. Whether processing massive amounts of data or optimizing database operations, SqlSugar is a powerful and reliable choice. Its high performance and rich feature set enable developers to easily cope with various complex scenarios and achieve fast and efficient database operations.

3. SqlSugar is a completely open source and MIT-licensed framework that provides all features comparable to paid components such as Z.EntityFramework.Extensions.EFCore and Dapper Plus without paying additional fees.

4. Ultra-high basic performance, for example, mapping 1 million notes to Listis faster than Dapper

SqlSugar Feature 4: Unlimited potential

Any open source is inseparable from an active community, and its future development will be better. Currently, SqlSugar has one of the most active communities for a single .NET open source project

And the solution rate on that day was 80%. The most diligent little bee in the open source world interacts with users every day, forming a virtuous cycle

The community has good suggestions and needs every day, pushing SqlSugar to develop to higher heights

SqlSugar Feature 5: Advanced Concept

SqlSugar is an ORM from the future, with advanced concepts and leading demand. It is no exaggeration to say that the design concept will not be outdated even if it is not updated for several years. We will track user needs every day , classify and sort out these user needs, and sort out the common functions. After 7 years of hard work, the demand has grown negatively, and it has become mature and perfect. It is a truly full-featured ORM framework. If you have used EF CORE or DAPPER, you will definitely be frustrated by the lack of functions. There are no functions that should be included, and there are a lot of bells and whistles. If you use SqlSugar, it will give you a good choice and constantly surprise you.

Dapper ORM

Dapper is a lightweight ORM tool. If you are using Entity Framework and NHibernate to handle big data access and relational mapping in a small project, it is a bit overkill. If you think ORM saves time and effort, then Dapper will be your best choice.

Object-relational mapping (ORM) has been used for a long time to solve the problem of mismatch between the object model and the data model in relational databases during programming.

Dapper is an open source, lightweight ORM developed by the Stack OverFlow team. Compared with other ORM frameworks, Dapper is very fast.

Dapper is designed with performance and ease of use in mind. It supports static and dynamic object binding using transactions, stored procedures or data bulk insertion.

EF Core ORM

Entity Framework (EF) Core is a lightweight, extensible, Open source and cross-platform version of commonly used Entity Framework data access technology.

EF Core can be used as an object-relational mapper (O/RM), which does two things:

  • Enables .NET developers to work with databases using .NET objects.
  • No need to write most of the data access code as usual.

EF Core supports multiple database engines, see Database provider for details.

Source code download:

Dapper ORM

https://github.com/DapperLib/Dapper

EF Core ORM

https://github.com/dotnet/efcore

SqlSugar ORM

https://github.com/DotNetNext/SqlSugar


ul>

  • Enables .NET developers to work with databases using .NET objects.
  • No need to write most of the data access code as usual.
  • EF Core supports multiple database engines, see Database provider for details.

    Source code download:

    Dapper ORM

    https://github.com/DapperLib/Dapper

    EF Core ORM

    https://github.com/dotnet/efcore

    SqlSugar ORM

    https://github.com/DotNetNext/SqlSugar


    This article is from the internet and does not represent1024programmerPosition, please indicate the source when reprinting:https://www.1024programmer.com/net-mainstream-orm-function-introduction-encyclopedia-latest/

    author: admin

    Previous article
    Next article

    Leave a Reply

    Your email address will not be published. Required fields are marked *

    The latest and most comprehensive programming knowledge, all in 1024programmer.com

    © 2023 1024programmer - Encyclopedia of Programming Field
    Contact Us

    Contact us

    181-3619-1160

    Online consultation: QQ交谈

    E-mail: [email protected]

    Working hours: Monday to Friday, 9:00-17:30, holidays off

    Follow wechat
    Scan wechat and follow us

    Scan wechat and follow us