当前位置:网站首页>Extend ado Net to realize object-oriented CRUD (.Net core/framework)
Extend ado Net to realize object-oriented CRUD (.Net core/framework)
2022-06-24 07:39:00 【User 8604107】
Expand ADO.net Realization of objectification CRUD(.net core/framework)
- <u> install nuget package :CRL</u>
- <u>using CRL;</u>
Realize data operation
Get data access connection IDbConnection dbConnection
By extending the method **GetDBExtend** obtain IAbsDBExtend object
public IAbsDBExtend GetDBExtend()
{
return dbConnection.GetDBExtend(dbTrans);
}Use IAbsDBExtend Implementation of object-oriented operation
var db = GetDBExtend();
db.BatchInsert(new List<TestClass>() { new TestClass() { Id = DateTime.Now.Millisecond, Name = "ddddd" } },true);
db.Update(b => b.Id == 1, new { Number = 2 });**IAbsDBExtend** All data operations can be realized , Such as :
- Batch update
- Batch deletion
- Batch insert
- stored procedure
- Table field 、 The index inspection
Implement query
By extending the method **GetLambdaQuery<T>** obtain ILambdaQuery object
public ILambdaQuery<T> GetLambdaQuery<T>() where T : class
{
return dbConnection.GetLambdaQuery<T>(dbTrans);
}Use ILambdaQuery Implement query
var query = GetLambdaQuery<TestClass>();
query.Join<TestClass2>((a, b) => a.Id == b.Id);
query.PrintQuery();<u>ILambdaQuery It can realize sub query and nested query , As long as meet T-SQL Semantic logic , have access to ILambdaQueryResultSelect Infinite superposition </u>
Such as :
- join after group
- join Later join
- group Later join
- join One group result
- join One union result
- Yes union Conduct group Again join
- ...
** Sample query :**
var q1 = GetLambdaQuery();
var q2 = q1.CreateQuery<Code.ProductData>();
q2.Where(b => b.Id > 0);
var view = q2.CreateQuery<Code.Member>().Where(b => b.Id > 0).GroupBy(b => b.Name).Select(b => new { b.Name, aa = b.Id.COUNT() });//GROUP Inquire about
var view2 = q2.Join(view, (a, b) => a.CategoryName == b.Name).Select((a, b) => new { ss1 = a.UserId, ss2 = b.aa });// relation GROUP
q1.Join(view2, (a, b) => a.Id == b.ss1).Select((a, b) => new { a.Id, b.ss1 }).ToList();// Again
//var result = view2.ToList();
var sql = q1.PrintQuery();Source code example reference
Data/QueryTest/test · hubroxxl/CRL - Code cloud - Open source in China (gitee.com)
边栏推荐
- UE常用控制台命令
- RDD基础知识点
- MySQL enable binlog
- When MFC uses the console, the project path cannot have spaces or Chinese, otherwise an error will be reported. Lnk1342 fails to save the backup copy of the binary file to be edited, etc
- How to open the soft keyboard in the computer, and how to open the soft keyboard in win10
- JVM debugging tool -jmap
- Analog display of the module taking software verifies the correctness of the module taking data, and reversely converts the bin file of the lattice array to display
- 10 common malware detection and analysis platforms
- 使用SystemParametersInfo访问用户界面设置
- What is an intrusion detection system?
猜你喜欢
![[WUSTCTF2020]alison_ likes_ jojo](/img/a9/dcc6f524772cd0b8781289cbaef63f.png)
[WUSTCTF2020]alison_ likes_ jojo

PIP install XXX on the terminal but no module named XXX on pycharm
![buuctf misc [UTCTF2020]docx](/img/e4/e160f704d6aa754e85056840e14bd2.png)
buuctf misc [UTCTF2020]docx
![[frame rate doubling] development and implementation of FPGA based video frame rate doubling system Verilog](/img/38/92486c92557e6e5a10a362eb2b7bdf.png)
[frame rate doubling] development and implementation of FPGA based video frame rate doubling system Verilog

【图像融合】基于伪 Wigner 分布 (PWD) 实现图像融合附matlab代码

相機標定(標定目的、原理)
![[GUET-CTF2019]zips](/img/79/22ff5d4a3cdc3fa9e0957ccc9bad4b.png)
[GUET-CTF2019]zips
![[equalizer] bit error rate performance comparison simulation of LS equalizer, def equalizer and LMMSE equalizer](/img/45/61258aa20cd287047c028f220b7f7a.png)
[equalizer] bit error rate performance comparison simulation of LS equalizer, def equalizer and LMMSE equalizer
![[WordPress website] 5 Set code highlight](/img/01/f669b70f236c334b98527a9320400c.png)
[WordPress website] 5 Set code highlight

Tutorial on simple use of Modbus to BACnet gateway
随机推荐
[WUSTCTF2020]alison_likes_jojo
The initial user names and passwords of Huawei devices are a large collection that engineers involved in Huawei business should keep in mind and collect!
Only two lines are displayed, and the excess part is displayed with Ellipsis
Dichotomous special training
Global and Chinese market of water massage column 2022-2028: Research Report on technology, participants, trends, market size and share
基因检测,如何帮助患者对抗疾病?
Prefix and topic training
Summary of 2022 blue team HW elementary interview questions
Leetcode probability interview shock series 11~15
[MRCTF2020]千层套路
Selector (>, ~, +, [])
Ultra wideband pulse positioning scheme, UWB precise positioning technology, wireless indoor positioning application
A case of bouncing around the system firewall
A penetration test of c/s Architecture - Request encryption, decryption and test
[learn FPGA programming from scratch -41]: vision chapter - Moore's era and Moore's law and the arrival of the post Moore Era
Obtain the package name, application name, icon, etc. of the uninstalled APK through packagemanager. There is a small message
利用微搭低代码实现级联选择
20 not to be missed ES6 tips
[OGeek2019]babyrop
L2TP connection failure guide in VPN