分享.NET 轻量级的ORM
ORM
https://github.com/StackExchange/dapper-dot-net
http://fluentdata.codeplex.com/
https://github.com/toptensoftware/PetaPoco
https://github.com/schotime/NPoco
https://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
分享.NET 轻量级的ORM的更多相关文章
- FluentData - 轻量级.NET ORM持久化技术解决方式
FluentData - 轻量级.NET ORM持久化技术解决方式 文件夹: 一.什么是ORM? 二.使用ORM的优势 三.使用ORM的缺点 四.NET下的ORM框架有哪些? 五.几 ...
- 轻量级.NET ORM、高性能.NET ORM 之 SqlSugar 开源ORM - ASP.NET
3.0最新API: http://www.cnblogs.com/sunkaixuan/p/5911334.html 1.前言/Preface SqlSugar从去年到现在已经一年了,版本从1.0升到 ...
- FluentData - 轻量级.NET ORM持久化技术解决方案
官方地址:http://fluentdata.codeplex.com/ 官方教程:http://fluentdata.codeplex.com/documentation FluentData入门 ...
- 开源一个基于dotnet standard的轻量级的ORM框架-Light.Data
还在dotnet framework 2.0的时代,当时还没有EF,而NHibernate之类的又太复杂,并且自己也有一些特殊需求,如查询结果直接入表.水平分表和新增数据默认值等,就试着折腾个轻量点O ...
- (源码下载)高灵活度,高适用性,高性能,轻量级的 ORM 实现
我在上一篇博客中简单说明了一个面向内存数据集的“ORM”的实现方法,也提到我的设计实现或许不能称之为“ORM”,姑且称之为 S-ORM吧. 可能有些小伙伴没有理解我的思路和目的,与传统ORM框架做了简 ...
- 高灵活度,高适用性,高性能,轻量级的 ORM 实现
ORM(Object-Relational Mapping 对象关系映射),它的作用是在关系型数据库和业务实体对象之间作一个映射,目的是提供易于理解的模型化数据的方法. ORM虽然有诸多好处,但是在实 ...
- Dos.ORM logo.Net轻量级开源ORM框架 Dos.ORM
http://www.oschina.net/p/dos-orm http://www.oschina.net/project/lang/194/csharp http://www.cnblogs.c ...
- 【原创】基于.NET的轻量级高性能 ORM - TZM.XFramework
[前言] 接上一篇<[原创]打造基于Dapper的数据访问层>,Dapper在应付多表自由关联.分组查询.匿名查询等应用场景时不免显得吃力,经常要手写SQL语句(或者用工具生成SQL配置文 ...
- 【原创】基于.NET的轻量级高性能 ORM - TZM.XFramework 之优雅增删改
[前言] 大家好,我是TANZAME.出乎意料的,我们在立冬的前一天又见面了,天气慢慢转凉,朋友们注意添衣保暖,愉快撸码.距离 TZM.XFramework 的首秀已数月有余,期间收到不少朋友的鼓励. ...
随机推荐
- js,javascript,删除元素,创建元素,插入子元素
删除元素示例代码 <html> <head> </head> <body> <div> <div id="delId&quo ...
- java混淆代码的使用
前言:为了保护我们的劳动成果,我们来学习java混淆代码工具的使用. 1.下载retroguard.jar 进入http://www.retrologic.com/retroguard-downloa ...
- RuntimeException
Throwable Error ... Exception !RuntimeException RuntimeException 两类:checked exceptions 和 unchecked e ...
- set_error_handler
set_error_handler这个函数的作用是为了防止错误路径泄露 何为错误路径泄露呢? 我们写程序,难免会有问题,而PHP遇到错误时,就会给出出错脚本的位置.行数和原因 有很多人说,这并没有什么 ...
- [Chrome_Error] (failed) net::ERR_INCOMPLETE_CHUNKED_ENCODING 与 nginx 502 bad gateway
Chrome 浏览器出现这个错误,还出现 nginx 502 bad gateway . 查看 nginx 的 error.log : 2015/12/18 14:34:44 [error] 1448 ...
- Delphi获取公网IP地址函数
uses IdHTTP; function GetPublicIP: string; var strIP, URL: string; iStart, iEnd: Integer; MyIdHTTP: ...
- [leetcode 120]triangle 空间O(n)算法
1 题目 Given a triangle, find the minimum path sum from top to bottom. Each step you may move to adjac ...
- EntityFramework Core 学习扫盲
0. 写在前面 1. 建立运行环境 2. 添加实体和映射数据库 1. 准备工作 2. Data Annotations 3. Fluent Api 3. 包含和排除实体类型 1. Data Annot ...
- [NewCode 5] 从尾到头打印链表
题目描述 输入一个链表,从尾到头打印链表每个节点的值. 题目比较水,一遍就 AC 了,来看代码: /** * struct ListNode { * int val; * struct ListNod ...
- C#调用haskell遭遇Attempted to read or write protected memory
1. Haskell的代码如下: 上面的代码中readMarkdown与writeHtmlString是pandoc中的函数,newString的作用是将String转换为IO CString. 2. ...