Esempio n. 1
0
 public QueryMany(Expression <Func <TModel, bool> > where, QueryOrder <TModel> order, int?skip, int?take, Graph <TModel> graph)
     : base(QueryOperation.Many)
 {
     this.Where = where;
     this.Order = order;
     this.Skip  = skip;
     this.Take  = take;
     this.Graph = graph;
 }
Esempio n. 2
0
 public QueryFirst(Expression <Func <TModel, bool> > where, QueryOrder <TModel> order, Graph <TModel> graph)
     : base(QueryOperation.First)
 {
     this.Where = where;
     this.Order = order;
     this.Skip  = null;
     this.Take  = null;
     this.Graph = graph;
 }
Esempio n. 3
0
        public string ConvertInternal(QueryOperation select, Expression where, QueryOrder order, int?skip, int?take, Graph graph, ModelDetail modelDetail)
        {
            var operationContext = new MemberContext();
            var sb = new CharWriteBuffer();

            try
            {
                Convert(ref sb, select, where, order, skip, take, graph, modelDetail, operationContext);
                return(sb.ToString());
            }
            finally
            {
                sb.Dispose();
            }
        }
Esempio n. 4
0
 public EventQueryMany(DateTime?temporalDateFrom, DateTime?temporalDateTo, int?temporalSkip, int?temporalTake, QueryOrder <TModel> order, int?skip, int?take, Graph <TModel> graph) : this(null, temporalDateFrom, temporalDateTo, null, null, temporalSkip, temporalTake, null, order, skip, take, graph)
 {
 }
Esempio n. 5
0
 public EventQueryMany(TemporalOrder temporalOrder, DateTime?temporalDateFrom, DateTime?temporalDateTo, QueryOrder <TModel> order) : this(temporalOrder, temporalDateFrom, temporalDateTo, null, null, null, null, null, order, null, null, null)
 {
 }
Esempio n. 6
0
 public QueryMany(Expression <Func <TModel, bool> > where, QueryOrder <TModel> order, Graph <TModel> graph) : this(where, order, null, null, graph)
 {
 }
Esempio n. 7
0
 public QueryMany(QueryOrder <TModel> order, Graph <TModel> graph) : this(null, order, null, null, graph)
 {
 }
Esempio n. 8
0
 public QueryMany(QueryOrder <TModel> order, int?skip, int?take) : this(null, order, skip, take, null)
 {
 }
Esempio n. 9
0
        //public static IOrderedQueryable<TSource> OrderBy<TSource, TModel>(this IQueryable<TSource> source, QueryOrder<TModel> linqOrder)
        //    where TModel : class, new()
        //{
        //    IQueryable<TSource> result = source;
        //    foreach (var order in linqOrder.OrderExpressions.Reverse())
        //    {
        //        var sourceOrder = LinqRebinder.RebindType(order.Expression, typeof(TModel), typeof(TSource));
        //        var propertyType = ((LambdaExpression)sourceOrder).ReturnType;
        //        if (order.Descending)
        //        {
        //            var method = TypeAnalyzer.GetGenericMethod(queryableOrderByDescending, typeof(TSource), propertyType);
        //            result = (IOrderedQueryable<TSource>)method.Caller(null, new object[] { result, sourceOrder });
        //        }
        //        else
        //        {
        //            var method = TypeAnalyzer.GetGenericMethod(queryableOrderBy, typeof(TSource), propertyType);
        //            result = (IOrderedQueryable<TSource>)method.Caller(null, new object[] { result, sourceOrder });
        //        }
        //    }
        //    return (IOrderedQueryable<TSource>)result;
        //}
        public static IOrderedQueryable <TModel> OrderBy <TModel>(this IQueryable <TModel> source, QueryOrder <TModel> linqOrder)
            where TModel : class, new()
        {
            IQueryable <TModel> result = source;

            foreach (var order in linqOrder.OrderExpressions.Reverse())
            {
                var propertyType = ((LambdaExpression)order.Expression).ReturnType;
                if (order.Descending)
                {
                    var method = TypeAnalyzer.GetGenericMethodDetail(queryableOrderByDescending, typeof(TModel), propertyType);
                    result = (IOrderedQueryable <TModel>)method.Caller(null, new object[] { result, order.Expression });
                }
                else
                {
                    var method = TypeAnalyzer.GetGenericMethodDetail(queryableOrderBy, typeof(TModel), propertyType);
                    result = (IOrderedQueryable <TModel>)method.Caller(null, new object[] { result, order.Expression });
                }
            }
            return((IOrderedQueryable <TModel>)result);
        }
Esempio n. 10
0
        protected void Convert(ref CharWriteBuffer sb, QueryOperation select, Expression where, QueryOrder order, int?skip, int?take, Graph graph, ModelDetail modelDetail, MemberContext operationContext)
        {
            var hasWhere         = where != null;
            var hasOrderSkipTake = (select == QueryOperation.Many || select == QueryOperation.First) && (order?.OrderExpressions.Length > 0 || skip > 0 || take > 0);

            GenerateSelect(select, graph, modelDetail, ref sb);

            GenerateFrom(modelDetail, ref sb);

            if (hasWhere || hasOrderSkipTake)
            {
                var rootDependant = new ParameterDependant(modelDetail, null);
                var sbWhereOrder  = new CharWriteBuffer();
                try
                {
                    if (hasWhere)
                    {
                        GenerateWhere(where, ref sbWhereOrder, rootDependant, operationContext);
                    }
                    if (hasOrderSkipTake)
                    {
                        GenerateOrderSkipTake(order, skip, take, ref sbWhereOrder, rootDependant, operationContext);
                    }

                    GenerateJoin(rootDependant, ref sb);

                    sb.Write(sbWhereOrder);
                }
                finally
                {
                    sbWhereOrder.Dispose();
                }
            }

            GenerateEnding(select, graph, modelDetail, ref sb);
        }
Esempio n. 11
0
 public EventQueryMany(TemporalOrder temporalOrder, ulong?temporalNumberFrom, ulong?temporalNumberTo, QueryOrder <TModel> order, Graph <TModel> graph) : this(temporalOrder, null, null, temporalNumberFrom, temporalNumberTo, null, null, null, order, null, null, graph)
 {
 }
Esempio n. 12
0
 public EventQueryMany(DateTime?temporalDateFrom, DateTime?temporalDateTo, Expression <Func <TModel, bool> > where, QueryOrder <TModel> order, int?skip, int?take) : this(null, temporalDateFrom, temporalDateTo, null, null, null, null, where, order, skip, take, null)
 {
 }
Esempio n. 13
0
 public EventQueryMany(TemporalOrder temporalOrder, ulong?temporalNumberFrom, ulong?temporalNumberTo, QueryOrder <TModel> order, int?skip, int?take) : this(temporalOrder, null, null, temporalNumberFrom, temporalNumberTo, null, null, null, order, skip, take, null)
 {
 }
Esempio n. 14
0
 public EventQueryMany(TemporalOrder temporalOrder, DateTime?temporalDateFrom, DateTime?temporalDateTo, int?temporalSkip, int?temporalTake, QueryOrder <TModel> order, Graph <TModel> graph) : this(temporalOrder, temporalDateFrom, temporalDateTo, null, null, temporalSkip, temporalTake, null, order, null, null, graph)
 {
 }
Esempio n. 15
0
 public EventQueryMany(TemporalOrder temporalOrder, DateTime?temporalDateFrom, DateTime?temporalDateTo, int?temporalSkip, int?temporalTake, Expression <Func <TModel, bool> > where, QueryOrder <TModel> order) : this(temporalOrder, temporalDateFrom, temporalDateTo, null, null, temporalSkip, temporalTake, where, order, null, null, null)
 {
 }
Esempio n. 16
0
 public EventQueryMany(TemporalOrder temporalOrder, DateTime?temporalDateFrom, DateTime?temporalDateTo, int?temporalSkip, int?temporalTake, QueryOrder <TModel> order, int?skip, int?take) : this(temporalOrder, temporalDateFrom, temporalDateTo, null, null, temporalSkip, temporalTake, null, order, skip, take, null)
 {
 }
Esempio n. 17
0
 public EventQueryMany(TemporalOrder temporalOrder, DateTime?temporalDateFrom, DateTime?temporalDateTo, Expression <Func <TModel, bool> > where, QueryOrder <TModel> order, int?skip, int?take, Graph <TModel> graph) : this(temporalOrder, temporalDateFrom, temporalDateTo, null, null, null, null, where, order, skip, take, graph)
 {
 }
Esempio n. 18
0
 public EventQueryMany(DateTime?temporalDateFrom, DateTime?temporalDateTo, int?temporalSkip, int?temporalTake, Expression <Func <TModel, bool> > where, QueryOrder <TModel> order, Graph <TModel> graph) : this(null, temporalDateFrom, temporalDateTo, null, null, temporalSkip, temporalTake, where, order, null, null, graph)
 {
 }
Esempio n. 19
0
 public EventQueryMany(TemporalOrder temporalOrder, ulong?temporalNumberFrom, ulong?temporalNumberTo, Expression <Func <TModel, bool> > where, QueryOrder <TModel> order, Graph <TModel> graph) : this(temporalOrder, null, null, temporalNumberFrom, temporalNumberTo, null, null, where, order, null, null, graph)
 {
 }
Esempio n. 20
0
 public EventQueryMany(TemporalOrder temporalOrder, ulong?temporalNumberFrom, ulong?temporalNumberTo, int?temporalSkip, int?temporalTake, QueryOrder <TModel> order, int?skip, int?take, Graph <TModel> graph) : this(temporalOrder, null, null, temporalNumberFrom, temporalNumberTo, temporalSkip, temporalTake, null, order, skip, take, graph)
 {
 }
Esempio n. 21
0
 private static QueryOrder <TModel> CompressOrder(QueryOrder <TModel> order)
 {
     return(order);
 }
Esempio n. 22
0
 public EventQueryMany(DateTime?temporalDateFrom, DateTime?temporalDateTo, QueryOrder <TModel> order, Graph <TModel> graph) : this(null, temporalDateFrom, temporalDateTo, null, null, null, null, null, order, null, null, graph)
 {
 }
Esempio n. 23
0
 public QueryMany(QueryOrder <TModel> order) : this(null, order, null, null, null)
 {
 }
Esempio n. 24
0
 public EventQueryMany(TemporalOrder temporalOrder, ulong?temporalNumberFrom, ulong?temporalNumberTo, int?temporalSkip, int?temporalTake, Expression <Func <TModel, bool> > where, QueryOrder <TModel> order, int?skip, int?take, Graph <TModel> graph) : this(temporalOrder, null, null, temporalNumberFrom, temporalNumberTo, temporalSkip, temporalTake, where, order, skip, take, graph)
 {
 }
Esempio n. 25
0
 public QueryMany(Expression <Func <TModel, bool> > where, QueryOrder <TModel> order, int?skip, int?take) : this(where, order, skip, take, null)
 {
 }
Esempio n. 26
0
 public EventQueryMany(ulong?temporalNumberFrom, ulong?temporalNumberTo, int?temporalSkip, int?temporalTake, QueryOrder <TModel> order) : this(null, null, null, temporalNumberFrom, temporalNumberTo, temporalSkip, temporalTake, null, order, null, null, null)
 {
 }
Esempio n. 27
0
 public QueryMany(QueryOrder <TModel> order, int?skip, int?take, Graph <TModel> graph) : this(null, order, skip, take, graph)
 {
 }
Esempio n. 28
0
 public EventQueryMany(DateTime?temporalDateFrom, DateTime?temporalDateTo, int?temporalSkip, int?temporalTake, QueryOrder <TModel> order) : this(null, temporalDateFrom, temporalDateTo, null, null, temporalSkip, temporalTake, null, order, null, null, null)
 {
 }
Esempio n. 29
0
        public EventQueryMany(TemporalOrder?temporalOrder, DateTime?temporalDateFrom, DateTime?temporalDateTo, ulong?temporalNumberFrom, ulong?temporalNumberTo, int?temporalSkip, int?temporalTake, Expression <Func <TModel, bool> > where, QueryOrder <TModel> order, int?skip, int?take, Graph <TModel> graph)
            : base(QueryOperation.EventMany)
        {
            this.TemporalOrder      = temporalOrder ?? Repository.TemporalOrder.Newest;
            this.TemporalDateFrom   = temporalDateFrom;
            this.TemporalDateTo     = temporalDateTo;
            this.TemporalNumberFrom = temporalNumberFrom;
            this.TemporalNumberTo   = temporalNumberTo;
            this.TemporalSkip       = temporalSkip;
            this.TemporalTake       = temporalTake;

            this.Where = where;
            this.Order = order;
            this.Skip  = skip;
            this.Take  = take;
            this.Graph = graph;
        }
Esempio n. 30
0
 public EventQueryMany(ulong?temporalNumberFrom, ulong?temporalNumberTo, int?temporalSkip, int?temporalTake, Expression <Func <TModel, bool> > where, QueryOrder <TModel> order) : this(null, null, null, temporalNumberFrom, temporalNumberTo, temporalSkip, temporalTake, where, order, null, null, null)
 {
 }