MongoDB的官方驱动,语法更好,更强
之前写过关于IMongoRepository仓储的文章,在mongodb的驱动选择上使用了NoRM,但是进行$ref引用类型导航时出现了问题,它对引用类型属性支持不是很好,还是使用几年前的泛型技术而没有使用Attribute,在这个方面官方驱动做的更好,所以,我还是使用官方驱动又实现了一次IMongoRepository,把一些实现的细节封装在了底层,我们叫这个官方仓储为MongoOfficialRepository,呵呵,谁叫你来的晚呢,MongoRepository已经为NoRM占上了,呵呵。
新的IMongoRepository接口内容添加了4个方法
/// <summary>
/// 官方驱动,返回带分页的结果集
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <returns></returns>
PagedResult<TEntity> GetModel(int pageIndex, int pageSize); /// <summary>
/// 官方驱动,返回带条件和分页的结果集
/// </summary>
/// <param name="expression"></param>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <returns></returns>
PagedResult<TEntity> GetModel(Expression<Func<TEntity, bool>> expression, int pageIndex, int pageSize); /// <summary>
/// 官方驱动,返回带排序和分页的结果集
/// </summary>
/// <param name="fields"></param>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <returns></returns>
PagedResult<TEntity> GetModel(Dictionary<Expression<Func<TEntity, object>>, bool> fields, int pageIndex, int pageSize); /// <summary>
/// 官方驱动,返回带条件和排序及分页的结果集
/// </summary>
/// <param name="expression"></param>
/// <param name="fields"></param>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <returns></returns>
PagedResult<TEntity> GetModel(Expression<Func<TEntity, bool>> expression, Dictionary<Expression<Func<TEntity, object>>, bool> fields, int pageIndex, int pageSize);
对这四大方法的实现,为了不让MongoDB的更多细节公开,所以,更多的内核只能在仓储中实现了,呵呵
public PagedResult<TEntity> GetModel(int pageIndex, int pageSize)
{
return GetModel(i => true, pageIndex, pageSize);
} public PagedResult<TEntity> GetModel(Expression<Func<TEntity, bool>> expression, int pageIndex, int pageSize)
{
return GetModel(expression, new Dictionary<Expression<Func<TEntity, object>>, bool>(), pageIndex, pageSize);
} public PagedResult<TEntity> GetModel(
Dictionary<Expression<Func<TEntity, object>>, bool> fields,
int pageIndex,
int pageSize)
{
return GetModel(i => true, fields, pageIndex, pageSize);
} public PagedResult<TEntity> GetModel(
Expression<Func<TEntity, bool>> expression,
Dictionary<Expression<Func<TEntity, object>>, bool> fields,
int pageIndex,
int pageSize)
{ SortDefinition<TEntity> sorts = new ObjectSortDefinition<TEntity>(new { });
foreach (var item in fields)
{
if (item.Value)
sorts = sorts.Ascending(item.Key);
else
sorts = sorts.Descending(item.Key);
}
var skip = (pageIndex - ) * pageSize;
var limit = pageSize;
var recordCount = _table.CountAsync<TEntity>(i => true).Result;
return new PagedResult<TEntity>(
recordCount,
(int)(recordCount + pageSize - ) / pageSize,
pageSize,
pageIndex,
_table.Find(expression)
.Sort(sorts)
.Skip(skip)
.Limit(limit)
.ToListAsync().Result);
}
OK,现在你可以在业务层去调用它了,基本上面四个方法可以满足你的一切需求了,呵呵!
看下在UI层对它的调用,本DEMO没有BLL层,呵呵
public ActionResult Index(int? loginNameSort, int? realNameSort, int page = )
{
Dictionary<Expression<Func<WebManageUsers, object>>, bool> sortList =
new System.Collections.Generic.Dictionary<Expression<Func<WebManageUsers, object>>, bool>();
if (loginNameSort.HasValue)
sortList.Add(i => i.LoginName, loginNameSort.Value == ); if (realNameSort.HasValue)
sortList.Add(i => i.RealName, realNameSort.Value == ); var model = _webManageUsersRepository.GetModel(sortList, page, );
return View(model);
}
aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAA84AAAC4CAIAAAC95CJOAAAgAElEQVR4nO2d+7MkZXnH8zfZVbBQllCCskggbOPRqlDBBZQsslxmJB5KKSpCUYVXZlxBjllQMKAISqsg4IkJlyUxMZ5WNl7D4VZeiMI5yJKKzPTMyQ8z3f3e++2Zvjzz9Lfr88Oenp7u7/M87+Xb7/TM/sXuzi4AAAAAAACgcv6idQUKwWpurecNAAAAAABQg5zVBgAAAAAAgAew2gAAAAAAANQCrDYAA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AAAABqAVYbAAAAAACAWoDVBgAAAAAAoBZgtQEAAAAAAKgFWG0AAAAAAABqAVYbAAAAAACAWoDVBgAAUEAQBEEQ6P8u+14AAOgasNoAAMCYrY21IAh6m/meaD3/U3/VTKHV3t4Ig/kWbmyrb9S3ttMCAAANAasNAABcidbnzlYw05u9YD2yvmqhwGpvD9aCIFiPFO8eBMHjj39rmRVxAABYdWC1AQCAJZmTlsz09ka4trFle1XHtixtMc1bG2tBsDbYtp+k7bQAAECjwGoDAABLovW1wbb2iMjmerC+aX3Vht/KdLQeqD5bcdgw3ACArgGrDQAAjFHM9NbGmvgsdbVWe2dvb2dzfX5Co8kW/w3DDQDoArDaAADAGNlMbw/WpFXn6q323mYvCGYL59YzAABAd4DVBgAAxshmOv9OpOlVDfeD2mb3LFjtcm8EAACOwGoDAABjJDOdfifS/OribPaCIJidOXuARDkG9hoA0E1gtQEAgDGSmU6/E2l+1UHhAyTC72pLZ8sO1v8BAABdAFYbAACAC90ce9plm0GH2wYAdAdYbQAAAFZstrjQLuveWjwebhsA0BFgtQEAAAAAAKgFWG0AAAAAAABqAVYbAAAAAACAWoDVBgAAAAAAoBZgtQEAAAAAAKgFWG0AAAAAAABqAVYbAAAAAACAWoDVBgAAAAAAoBZgtQEAAAAAAKgFWG0AAAAAAABqAVYbAAAAAACAWiBktbFhw4YNGzZs2LBh47RRsdoAAAAAAAAwA1YbAAAAAACAWoDVBgAAAAAAoBZgtQEAAAAAAKgFWG0AAAAAAABqAVYbAAAAAACAWoDVBgAAAAAAoBZgtQEAAAAAAKgFWG0AAAAAAABqAVYbAAAAAACAWoDVBgAAAAAAoBZgtQEAAAAAAKgFWG0AAAAAAABqAVYbAAAAAACAWoDVBgAAAAAAoBZgtQEAAAAAAKgFWG0AAAAAAABqAVYbAAAAAACAWoDVBgAAAAAAoBb+H+JCLu3vh0c8AAAAAElFTkSuQmCC" alt="" />
怎么样,看了上面代码是否心里痒痒了,哈哈,赶快去开发你自己的MongoDB仓储吧!
MongoDB学习笔记~为IMongoRepository接口添加了排序和表达式树,针对官方驱动的更多相关文章
-
MongoDB学习笔记~为IMongoRepository接口添加了增删改方法,针对官方驱动
回到目录 上一讲说了MongoDB官方驱动的查询功能,这回说一下官方驱动的增删改功能,驱动在升级为2.0后,相应的insert,update和delete都只有了异步版本(或者叫并行版本),这当然也是 ...
-
MongoDB学习笔记~为IMongoRepository接口添加分页取集合的方法
回到目录 对于数据分页,我们已经见的太多了,几乎每个列表页面都要用到分页,这已经成了一种定理了,在进行大数据展示时,如果不去分页,而直接把数据加载到内存,这简直是不可以去相向的,呵呵,在很多ORM工具 ...
-
MongoDB学习笔记~为IMongoRepository接口更新指定字段
回到目录 对于MongoDB来说,它的更新建议是对指定字段来说的,即不是把对象里的所有字段都进行update,而是按需去更新,这在性能上是最优的,这当然也是非常容易理解的,我们今天要实现的就是这种按需 ...
-
MongoDB学习笔记~大叔分享批量添加—批量更新—批量删除
回到目录 说它是批量操作,就是说将集合对象一次提交到服务器,并对数据进行持久化,如果您的代码是一次一次的提交,那不算是批量操作!在之前的mongodb仓储中并没有对批量更新和批量删除进行实现,而今天在 ...
-
MongoDB学习笔记系列
回到占占推荐博客索引 该来的总会来的,Ef,Redis,MVC甚至Sqlserver都有了自己的系列,MongoDB没有理由不去整理一下,这个系列都是平时在项目开发时总结出来的,希望可以为各位一些帮助 ...
-
MongoDB学习笔记系列~目录
MongoDB学习笔记~环境搭建 (2015-03-30 10:34) MongoDB学习笔记~MongoDBRepository仓储的实现 (2015-04-08 12:00) MongoDB学习笔 ...
-
MongoDB学习笔记:快速入门
MongoDB学习笔记:快速入门 一.MongoDB 简介 MongoDB 是由C++语言编写的,是一个基于分布式文件存储的开源数据库系统.在高负载的情况下,添加更多的节点,可以保证服务器性能.M ...
-
PHP操作MongoDB学习笔记
<?php/*** PHP操作MongoDB学习笔记*///*************************//** 连接MongoDB数据库 **////*************** ...
-
mongoDB 学习笔记纯干货(mongoose、增删改查、聚合、索引、连接、备份与恢复、监控等等)
最后更新时间:2017-07-13 11:10:49 原始文章链接:http://www.lovebxm.com/2017/07/13/mongodb_primer/ MongoDB - 简介 官网: ...
随机推荐
-
MyEclipse在搭建s2sh时 如何 uninstalled facet
在资源管理器中:找到当前[项目的根目录],在[.setting]目录中, 找到[org.eclipse.wst.common.project.facet.core.xml]文件. 用[文本编辑器工具] ...
-
mysql之show engine innodb status解读
注:以下内容为根据<高性能mysql第三版>和<mysql技术内幕innodb存储引擎>的innodb status部分的个人理解,如果有错误,还望指正!! innodb存 ...
-
php递归函数--遍历
多应用在 栏目多级.无限极调用 数据库数据如: id catname pid 1 关于我们 0 2 新闻 0 3 公司新闻 2 4 ...
-
android开发之路11(用SharedPreferences存储数据)
Android平台给我们提供了一个SharedPreferences类,实际上SharedPreferences处理的就是一个key-value(键值对),它是 一个轻量级的存储类,特别适合用于保存软 ...
-
Java与算法之(2) - 快速排序
快速排序的基本思路是,每次选定数列中的一个基准数,将小于基准数的数字都放到基准数左边,大于基准数的数字都放到基准数右边.然后再分别对基准数左右的两个数列分别重复以上过程.仍以4 3 6 2 7 1 5 ...
-
Excel动态图表
动态图表其实一点都不难,真的!先看效果,然后教你一步步实现.这是每个地区经销跟代销的数据.Step 01在开发工具插入表单控件.Step 02将表单控件调整到合适的大小,并设置控件格式.Step 03 ...
-
JavaGC学习笔记
1.简介Java在JVM虚拟机上的垃圾回收(GC)机制,在合适的时间触发垃圾回收,将不需要的内存空间回收释放,避免无限制的内存增长导致的OOM. 1.1 Java堆内存结构Java将堆内存分为3大部分 ...
-
洛谷P1309 瑞士轮(归并排序)
To 洛谷.1309 瑞士轮 题目背景 在双人对决的竞技性比赛,如乒乓球.羽毛球.国际象棋中,最常见的赛制是淘汰赛和循环赛.前者的特点是比赛场数少,每场都紧张刺激,但偶然性较高.后者的特点是较为公平, ...
-
C# windows程序应用与JavaScript 程序交互实现例子
C# windows程序应用与JavaScript 程序交互实现例子 最近项目中又遇到WinForm窗体内嵌入浏览器(webBrowser)的情况,而且涉及到C#与JavaScript的相互交互问题, ...
-
docker和kubernetes docker的区别
之前公司的测试环境,刚开始自己搭建虚拟机,然后安装redis,nginx,mq,mysql,tomcat,jdk,marven,还有jekins.前面些还算好点,jekins还是比较麻烦的.然后搭完以 ...