예제 #1
0
 public SortOrderSpec(QueryExpression queryExpression, SortOrder sortOrder, SortOrderSpec parent = null) : this(parent)
 {
     if (queryExpression != null)
     {
         Expressions.Add(new ExpressionWithSortOrder(queryExpression, sortOrder));
     }
 }
예제 #2
0
 public SortOrderSpec(SortOrderSpec parent = null)
 {
     if (parent != null)
     {
         Expressions.AddRange(parent.Expressions);
     }
 }
예제 #3
0
 public SortOrderSpec(LambdaExpression lambda, SortOrder sortOrder, SortOrderSpec parent = null) : this(parent)
 {
     if (lambda != null)
     {
         Expressions.Add(new ExpressionWithSortOrder(new LambdaQueryExpression(lambda), sortOrder));
     }
 }
예제 #4
0
 public QuerySpec CreateQuerySpec(FilterSpec filter, ScalarSpec expression, SortOrderSpec sortOrder, int?skip, int?take, TableSchema schema)
 {
     throw new NotSupportedException();
 }
예제 #5
0
        internal QuerySpec CreateQuerySpec(FilterSpec filter, ScalarSpec scalarSpec = null, int?skip = null, int?take = null, SortOrderSpec sortSpec = null)
        {
            if (DataProvider.SupportsQueryTranslation())
            {
                return(DataProvider.CreateQuerySpec(filter, scalarSpec, sortSpec, skip, take, Schema));
            }

            var querySpec = new QuerySpec(new CodeQuerySpec(), null);

            var codeQuerySpec = (CodeQuerySpec)querySpec.Code;

            if (filter != null)
            {
                foreach (var expression in filter.Expressions)
                {
                    codeQuerySpec.AddFilter(Schema, expression);
                }
            }

            if (sortSpec != null)
            {
                foreach (var expression in sortSpec.Expressions)
                {
                    codeQuerySpec.AddSort(Schema, expression.Expression, expression.SortOrder);
                }
            }

            if (scalarSpec != null)
            {
                codeQuerySpec.AddScalar(Schema, scalarSpec.Expression);
            }

            codeQuerySpec.Skip = skip;
            codeQuerySpec.Take = take;

            return(querySpec);
        }