コード例 #1
0
 /// <summary>
 /// 分页查询
 /// </summary>
 /// <typeparam name="T">类型</typeparam>
 /// <param name="where">查询表达式</param>
 /// <param name="orderby">排序</param>
 /// <param name="pageIndex">页码</param>
 /// <param name="pageSize">单页容量</param>
 /// <param name="pageCount">总页数</param>
 /// <param name="allCount">总条目数</param>
 /// <returns></returns>
 public static IQueryable <T> Select <T>(Expression <Func <T, bool> > where, Expression <Func <T, object> > orderby, int pageIndex, int pageSize, out int pageCount, out int allCount) where T : IEntity
 {
     pageCount = 0;
     allCount  = 0;
     IsTypeCanBeUsed(typeof(T));
     return(EntityOperationExtensions.DBSelect <T>(where, orderby, pageIndex, pageSize, out pageCount, out allCount));
 }
コード例 #2
0
        public static List <T> RefPick <T>(this List <MongoDBRef> lst) where T : IEntity
        {
            if (lst == null)
            {
                return(new List <T>());
            }
            var ids = lst.Where(i => i.CollectionName == typeof(T).DBCollectionName()).Select(i => i.Id).ToArray();

            return(EntityOperationExtensions.DBSelect <T>(i => ids.Contains(i.Id)).ToList());
        }
コード例 #3
0
        public static bool RefExists <T>(this List <MongoDBRef> lst, Expression <Func <T, bool> > where) where T : IEntity
        {
            if (lst == null)
            {
                return(false);
            }
            var ids = lst.Where(i => i.CollectionName == typeof(T).DBCollectionName()).Select(i => i.Id).ToArray();

            if (ids.Length == 0)
            {
                return(false);
            }
            return(EntityOperationExtensions.DBSelect <T>(i => ids.Contains(i.Id)).All(where));
        }
コード例 #4
0
 /// <summary>
 /// 查询
 /// </summary>
 /// <typeparam name="T">类型</typeparam>
 /// <param name="where">查询表达式</param>
 /// <returns></returns>
 public static IQueryable <T> Select <T>(Expression <Func <T, bool> > where) where T : IEntity
 {
     IsTypeCanBeUsed(typeof(T));
     return(EntityOperationExtensions.DBSelect <T>(where));
 }