It refers to an ORM and introduces an ORM.

Source: Internet
Author: User

It refers to an ORM and introduces an ORM.

It refers to an ORM, which is based on Dapper extensions.

Why Is An ORM required?

Supports Simple LINQ queries

But cannot be connected to the Table query, why? Why? Why? Why can't I connect to query ^. ^ OK. But it is not supported. Hahahahahahahaha. Finally, let's talk about why.

SQL Basics

Basic Writing Method

Once

Secondary

Three times

First, the system will be bloated, and the amount of DLL compilation code will increase.

Second, inconvenient maintenance

Third: The DLL has become larger, the memory occupied during creation is no longer ................................. ................... okay, now you get started again.

 

At this time, we need a convenient and reusable thing (ORM)

 

 

Let's start by introducing how to use IT (ORM executes SQL at last, so model to SQL ):

Entity class (OK, we use features)

Table: Table Name

Key: Primary Key

Identity: Automatically increasing Columns

Status: Logical deletion (false deletion)

Haha, should I manually write hundreds of tables? No. The T4 template is automatically generated.

 

Now let's look at the extended structure:

 

 

Find (query ):

 

TEntity Find (Expression <Func <TEntity, bool> expression)

Expression query condition: If the expression is repeated, only the Top 1 record is queried.

 

Delete ):

Bool Delete (TEntity instance ):

Instance: deletes an instance based on the Key (primary Key) in the object class.

Bool Delete (Expression <Func <TEntity, bool> expression ):

Expression: the condition is the same as the query condition.

 

Update (modify ):

Bool Update (TEntity instance ):

Instance: modifies an object class based on the object class Key (primary Key ).

Update (TEntity instance, Expression <Func <TEntity, object> field ):

Instance \ field: modifies the field specified by the object class based on the object class Key (primary Key)

Bool Update (TEntity instance, Expression <Func <TEntity, object> field, Expression <Func <TEntity, bool> expression ):

Instance \ field \ expression: Modify the fields specified by the object class (instance) according to the top condition (expression) (field-> all fields when field is Null)

 

Okay, next page:

From: page number

To: number of entries per page

Expression: Condition

Scfield: Sorting Condition

IdDesc: whether to descending

 

 

Nothing special, no transaction, no transaction, no perfect ORM... I also want to say, what do you write yourself?

What ORM, MDZZ ~~~

 

No linked list or subquery is required. Each table in the database can be distributed on different servers. This solution perfectly solves the Data Relationship and easily carries tens of billions of data and tens of millions of traffic, the perfect idea ............ hahaha

 

Data Connection Pool --->

1. Resource Reuse

2. Faster system response

3. New Resource allocation methods

4. Unified connection management to avoid database connection leaks

Configuration file.

Key = default connection string: An unconfigured object class connects to the default database

Key = table name: the configured OBJECT class connects to the configured Database

Why? Why? Why? To facilitate table sharding:

The data volume in the database is not necessarily controllable. When database and table sharding is not performed, as time and business grows, the number of tables in the database increases and the data volume in the table increases, correspondingly, the overhead for adding, deleting, modifying, and querying data operations will also increase. In addition, due to the inability to conduct distributed deployment, the resources of one server (CPU, disk, memory, IO, etc) it is limited, and the data volume and data processing capability that the database can carry will all experience bottlenecks.

Okay, this is a brief description. Let's find the information and use the 'land reclamation power ';

 

What should I do if I cannot meet the common writing requirements for table connection queries? :

Use AutoMapper to connect. Foreach... there are many codes.

 

Transaction, how to do it, write it yourself:

 

If data consistency requirements are high, you can only lock (Distributed Lock), or database write Stored Procedure transactions ....

 

 

 

So... Is An ORM!

 

Open Source Address

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.