示例#1
0
        /// <summary>
        /// 使用CRLExpression从缓存中查询
        /// 仅在缓存接口部署
        /// </summary>
        /// <param name="expression"></param>
        /// <returns></returns>
        CacheServer.ResultData QueryFromCache(LambdaQuery.CRLQueryExpression expression)
        {
            var _CRLExpression = new CRL.LambdaQuery.CRLExpressionVisitor <TModel>().CreateLambda(expression.Expression);
            int total;
            var data = QueryFromCacheBase(_CRLExpression, out total, expression.PageIndex, expression.PageSize);

            return(new CacheServer.ResultData()
            {
                Total = total, JsonData = CoreHelper.StringHelper.SerializerToJson(data)
            });
        }
示例#2
0
 /// <summary>
 /// 直接按查询数据
 /// </summary>
 /// <param name="command"></param>
 /// <returns></returns>
 public CacheServer.ResultData DeaDataQueryCommand(CacheServer.Command command)
 {
     if (command.CommandType == CacheServer.CommandType.查询)
     {
         var expression     = LambdaQuery.CRLQueryExpression.FromJson(command.Data);
         var _CRLExpression = new CRL.LambdaQuery.CRLExpressionVisitor <TModel>().CreateLambda(expression.Expression);
         var query          = GetLambdaQuery();
         query.Where(_CRLExpression);
         query.Page(expression.PageSize, expression.PageIndex);
         var data  = query.ToList();
         int total = query.RowCount;
         return(new CacheServer.ResultData()
         {
             Total = total, JsonData = CoreHelper.StringHelper.SerializerToJson(data)
         });
     }
     else
     {
         //更新缓存
         //var item = (TModel)CoreHelper.SerializeHelper.SerializerFromJSON(command.Data, typeof(TModel), Encoding.UTF8);
         //UpdateById(item);
         return(new CacheServer.ResultData());
     }
 }