. NET lightweight ORM Framework Dapper practicing manual

Source: Internet
Author: User
Tags bulk insert

I. Summary

1.1, why call this sharing lesson called " cultivation Handbook "?

I hope this sharing lesson involves some of the little tips and tricks that will help you. I hope that you will be in the future work as a practical skill manual to reserve, in case of a rainy day, once you have encountered with the dapper practice manual similar to the place and scene, can be directly used to browse and flexible application to the project. At last, I suggest that you can constantly improve this manual according to the different usage scenarios you encounter in your work.

Needless to say, directly on dry goods, we do not produce dry goods, we are just dry goods porter.

Iv. knowledge points relating to coverage

1. C # LINQ to XML technology.

2. The handbook of Transact-SQL cultivation. such as how to use temporary tables, create user-defined tables (table), XML data fields, Row_number paging functions, stored procedure practice Manuals (Dynamic execution SQL, exception handling mechanism, transaction mechanism), C # How to get the output of the stored procedure, return parameter value.

3, SQL Sever FOR XML technology (XML PATH, XML RAW, XML Auto Simple usage introduction).

4. Transact-SQL keyword OPENXML the XML document in the Operation memory.

5, Faker.net imitate the test data frame application.

6, vs unit Test nuittest use.

7. The application of dapper in asynchronous programming (Asyn Task).

8, the original dapper simple crud (increase and revise) practice manual. (highly recommended)

9, dapper How to use dynamicparameters dynamic splicing query SQL practice manual. (highly recommended)

10, dapper Expansion library dapper.sqlbuilder, Uniquenamespace.sqlbuilder practice Manual. (highly recommended)

11, the native dapper Advanced skill practice manual. (highly recommended)

12, Dapper Expansion library dapper-extensions practice manual. (highly recommended)

Five, dapper Practice manual online Demo

5.1, native dapper simple crud (increase and revise) Manual of cultivation

Insert, Insert_batch (BULK insert data).

Update, Delete, Exist.

GetById, GetList, getbyids (in clause use).

Getlistreturndynamic (returns dynamic).

Getlistbymultiquery (returns a multi-result set TUPLE<TRESULT1,TRESULT2,...... >).

Executewithdbtransaction (local dbtransaction transaction operation).

Executewithtransactionscope (distributed TransactionScope Transaction Operations).

5.2, dapper How to use dynamicparameters dynamic splicing query SQL practice Manual

Insert, Getlistbygenreidandname appreciate the dynamicparameters style.

Searchordersbypagedynamicparameterssqlbuild: Get Paging data (by dynamicparameters dynamic stitching Query SQL method stitching + row_number () over clause paging).

Searchordersbydynamicparametersoutputandreturnvaule: How to construct and get the stored procedure output, return parameter values using Dynamicparameters, And the Get stored procedure returns one or more result sets.

5.3. Dapper Expansion Library Dapper.sqlbuilder training manual

Constructs a crud statement template through Sqlbuilder.

Constructs a Select (query), page (pagination) statement template by Sqlbuilder the built-in template.

Getorderonetomanybydappersqlbuilder: Gets the order "one-to-many" through the SQL Syntax XML path clause.

Searchordersbypagedappersqlbuilder: Gets paging data (via Dapper.sqlbuilder stitching + row_number () over clause pagination).

Searchordersbydapperdappersqlbuildersqlpagingtemplates gets paging data (paginated by Dapper.sqlbuilder the built-in paging template).

5.4, the native Dapper Advanced Skill Practice Handbook

Createorder: Create order (with SQL stitching +for loop).

Createorderbystoredprocedures_xmlpath: Create order (in Xmlpath mode that generates XML+SQL XML data type).

Createorderbystoredprocedures_openxml: Create order (in OPENXML mode that generates XML+SQL XML data type).

Createorderbystoredprocedures_customtabletype: Create orders (using SQL users to create custom table types).

Getorderonetomanybysqlbuilder: Get Orders (one-to-many) through the master-slave table SQL statement mode.

Getorderonetomanybydapperquery: Get Orders (one-to-many) through native dapper Query+spliton keywords.

Searchordersbypagesqlbuild: Gets paging data (via SQL statement stitching + row_number () over clause pagination).

Searchordersbypagesqlstoredprocedures: Gets paging data (via SQL paging stored procedure + row_number () over clause paging).

5.5. Dapper Expansion Library Dapper-extensions training manual

1, insert, Insert_batch (BULK insert data).

2, Update, Delete, Exist.

3, insert_batchbysqlbulkcopy (BULK insert data based on the SqlBulkCopy method).

4, GetList: Contains the following knowledge points:

* Query based on criteria (with filters and sort fields).

* Query based on multi-combination criteria (ipredicate predicates.group () to generate filter conditions + sort fields).

* Query based on multi-combination criteria (by Ipredicate.add () to generate filter conditions + sort fields).

* Query based on multiple combinations (predicate multiple conditional compound predicate combinations to generate filter conditions + Sort fields, sample SQL statement: Select * from Table Where ([email protected] and [email protected] ) OR ([email protected] and [email protected]).

* Sub-query query based on single criteria (via Ipredicate.exists () subquery filter condition statement + sort field, sample statement: SELECT * Form table where EXISTS (select 1 from table where [E Mail protected]).

* Sub-query query based on multi-combination conditions (via ipredicate.exists () subquery filter condition statement + sort field, sample statement: SELECT * FROM Table Where EXISTS (select Count (1) from table Where ([email protected] and [email protected]) OR ([email protected] and [email protected])).

*searchordersbypagedapperextensions: Gets the paging data (the built-in count, page function is ipredicate+ by the extended dapperextensions multi-conditional composite predicate provided).

Vi. Summary

In the world of ADO, "The sea is wide by diving, the sky high as a bird fly."

The ability to Transact-SQL programming is another step.

A taste of dapper her "beauty"!

After learning this manual, you will be drawn to the full of dry goods, so that you have more confidence!

Follow-up plan: Stupid will follow up the plan to bring you another sharing lesson. NET Lightweight ORM component Dapper, probably including Dapper for Mssql,dapper for Mysql, Dapper for Oracle, The repository mode of the data access layer and the application of the warehouse mode based on dapper open source, etc.

. NET lightweight ORM Framework Dapper practicing manual

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.