This article is a mirror article of machine translation, please click here to jump to the original article.

View: 23345|Reply: 0

[Source] The ORM framework Dapper gets the executed sql statement

[Copy link]
Posted on 4/28/2019 2:58:27 PM | | | |
Dapper is an ORM framework under .NET. According to the official tutorial, it is easy to get started, I am not too deep in use, I used the DapperExtensions extension, the introduction is as follows:
A small library that complements Dapper by adding basic CRUD operations (get, insert, update, delete) to your POCO. For more advanced query scenarios, Dapper Extensions provides a predicate system.
Through the code, you can perform simple addition, deletion, modification and query operations on the table, what if we want to get the executed SQL statement?



The code is as follows:



Calling Code:

Generated SQL statement:

[ExecuteReader(SequentialAccess)] SELECT TOP(10) [_proj]. [Id], [_proj]. [RecommendIds], [_proj]. [Count], [_proj]. [Language], [_proj]. [_CreateTime], [_proj]. [_UpdateTime] FROM (SELECT ROW_NUMBER() OVER(ORDER BY [itsvse].[ Id] DESC) AS [_row_number], [itsvse]. [Id], [itsvse]. [RecommendIds], [itsvse]. [Count], [itsvse]. [Language], [itsvse]. [_CreateTime], [itsvse]. [_UpdateTime] FROM [itsvse]) [_proj] WHERE [_proj]. [_row_number] >= @_pageStartRow ORDER BY [_proj]. [_row_number]



EF has two ways to obtain SQL statements generated by the ORM framework, the tutorial is as follows:

ef displays the generated SQL statements
https://www.itsvse.com/thread-3813-1-1.html
(Source: Architect_Programmer)







Previous:Humanities and Sociology Translation Series 53 volumes
Next:Let the numbers show the SQL of the words
Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com