当前位置:网站首页>分享.NET 轻量级的ORM
分享.NET 轻量级的ORM
2022-07-05 10:12:00 【全栈程序员站长】
ORM
https://github.com/StackExchange/dapper-dot-nethttp://fluentdata.codeplex.com/https://github.com/toptensoftware/PetaPocohttps://github.com/schotime/NPocohttps://github.com/ServiceStack/ServiceStack.OrmLite
使用Dapper
1.已经在项目中使用了Dapper,感觉还行,基本可以满足需求 2.使用Dapper一段时间,AnsiStringFixedLength 与AnsiString区别 http://stackoverflow.com/search?page=1&tab=votes&q=dapper 3.扩展Dapper : https://github.com/tmsmith/Dapper-Extensions or Dapper.Rainbow VS Dapper.Contrib
影响执行计划
Ansi Strings and varchar
Dapper supports varchar params, if you are executing a where clause on a varchar column using a param be sure to pass it in this way:
Query<Thing>("select * from Thing where Name = @Name", new {Name = new DbString { Value = "abcde", IsFixedLength = true, Length = 10, IsAnsi = true });
List Support
Dapper allow you to pass in IEnumerable and will automatically parameterize your query.
For example:
connection.Query<int>("select * from (select 1 as Id union all select 2 union all select 3) as X where Id in @Ids", new { Ids = new int[] { 1, 2, 3 });
Will be translated to:
select * from (select 1 as Id union all select 2 union all select 3) as X where Id in (@Ids1, @Ids2, @Ids3)" // @Ids1 = 1 , @Ids2 = 2 , @Ids2 = 3
_db.Query<Users>("SELECT * FROM dbo.Users WHERE id IN @ids ",new { ids = IDs.ToArray()}).ToList();
Refer: Dapper.Rainbow VS Dapper.Contrib http://stackoverflow.com/questions/10030285/dapper-rainbow-vs-dapper-contrib Using Dapper QueryMultiple in Oracle http://stackoverflow.com/questions/18772781/using-dapper-querymultiple-in-oracle SELECT * FROM X WHERE id IN (…) with Dapper ORM http://stackoverflow.com/questions/8388093/select-from-x-where-id-in-with-dapper-orm 扩展Dapper https://github.com/tmsmith/Dapper-Extensions Any Question http://stackoverflow.com/search?page=1&tab=votes&q=dapper
发布者:全栈程序员栈长,转载请注明出处:https://javaforall.cn/109868.html原文链接:https://javaforall.cn
边栏推荐
- 各位大佬,我测试起了3条线程同时往3个mysql表中写入,每条线程分别写入100000条数据,用了f
- Have you learned to make money in Dingding, enterprise micro and Feishu?
- Flink CDC cannot monitor MySQL logs. Have you ever encountered this problem?
- 横向滚动的RecycleView一屏显示五个半,低于五个平均分布
- MySQL digital type learning notes
- Glide conclusion
- WorkManager學習一
- B站大量虚拟主播被集体强制退款:收入蒸发,还倒欠B站;乔布斯被追授美国总统自由勋章;Grafana 9 发布|极客头条...
- Tianlong Babu TLBB series - about items dropped from packages
- Unity particle special effects series - the poison spray preform is ready, and the unitypackage package can be used directly - next
猜你喜欢
> Could not create task ‘:app:MyTest.main()‘. > SourceSet with name ‘main‘ not found.问题修复
学习笔记4--高精度地图关键技术(下)
> Could not create task ‘:app:MyTest. main()‘. > SourceSet with name ‘main‘ not found. Problem repair
非技術部門,如何參與 DevOps?
Fluent generates icon prompt logo widget
Universal double button or single button pop-up
C语言实现QQ聊天室小项目 [完整源码]
SAP ui5 objectpagelayout control usage sharing
Have you learned to make money in Dingding, enterprise micro and Feishu?
学习笔记6--卫星定位技术(上)
随机推荐
A large number of virtual anchors in station B were collectively forced to refund: revenue evaporated, but they still owe station B; Jobs was posthumously awarded the U.S. presidential medal of freedo
flink cdc不能监听mysql日志,大家遇到过这个问题吧?
字节跳动面试官:一张图片占据的内存大小是如何计算
Tianlong Babu TLBB series - about items dropped from packages
Shortcut keys for vscode
5G NR系统架构
C#函数返回多个值方法
Window下线程与线程同步总结
mongoDB副本集
Qt实现json解析
【观察】跨境电商“独立站”模式崛起,如何抓住下一个红利爆发时代?
Learning Note 6 - satellite positioning technology (Part 1)
How to judge that the thread pool has completed all tasks?
[JS] array dimensionality reduction
Swift tableview style (I) system basic
DDOS攻击原理,被ddos攻击的现象
[paper reading] kgat: knowledge graph attention network for recommendation
自动化规范检查软件如何发展而来?
Idea create a new sprintboot project
【黑马早报】罗永浩回应调侃东方甄选;董卿丈夫密春雷被执行超7亿;吉利正式收购魅族;华为发布问界M7;豆瓣为周杰伦专辑提前开分道歉...