Ejemplo n.º 1
0
 private QueryModel ApplyAllNodes(IExpressionNode node, ClauseGenerationContext clauseGenerationContext)
 {
     QueryModel queryModel = null;
     if (node.Source != null)
         queryModel = ApplyAllNodes(node.Source, clauseGenerationContext);
     return node.Apply(queryModel, clauseGenerationContext);
 }
Ejemplo n.º 2
0
    protected override void ApplyNodeSpecificSemantics (QueryModel queryModel, ClauseGenerationContext clauseGenerationContext)
    {
      ArgumentUtility.CheckNotNull ("queryModel", queryModel);

      var clause = new WhereClause (GetResolvedPredicate (clauseGenerationContext));
      queryModel.BodyClauses.Add (clause);
    }
        protected override QueryModel ApplyNodeSpecificSemantics(QueryModel queryModel,
            ClauseGenerationContext clauseGenerationContext)
        {
            queryModel.BodyClauses.Add(new WhereMissingClause(GetResolvedPredicate(clauseGenerationContext)));

            return queryModel;
        }
 public override Expression Resolve(ParameterExpression inputParameter, Expression expressionToBeResolved, ClauseGenerationContext clauseGenerationContext)
 {
     ArgumentUtility.CheckNotNull("inputParameter", inputParameter);
     ArgumentUtility.CheckNotNull("expressionToBeResolved", expressionToBeResolved);
     ArgumentUtility.CheckNotNull("clauseGenerationContext", clauseGenerationContext);
     return Source.Resolve(inputParameter, expressionToBeResolved, clauseGenerationContext);
 }
        protected override QueryModel ApplyNodeSpecificSemantics(QueryModel queryModel,
            ClauseGenerationContext clauseGenerationContext)
        {
            queryModel.BodyClauses.Add(new UseKeysClause(Keys));

            return queryModel;
        }
 public override Expression Resolve(
     ParameterExpression inputParameter,
     Expression expressionToBeResolved,
     ClauseGenerationContext clauseGenerationContext)
     => Source.Resolve(
         inputParameter,
         expressionToBeResolved,
         clauseGenerationContext);
Ejemplo n.º 7
0
    public override Expression Resolve (ParameterExpression inputParameter, Expression expressionToBeResolved, ClauseGenerationContext clauseGenerationContext)
    {
      ArgumentUtility.CheckNotNull ("inputParameter", inputParameter);
      ArgumentUtility.CheckNotNull ("expressionToBeResolved", expressionToBeResolved);

      // no data streams out from this node, so we cannot resolve any expressions
      throw CreateResolveNotSupportedException ();
    }
Ejemplo n.º 8
0
    public override Expression Resolve (ParameterExpression inputParameter, Expression expressionToBeResolved, ClauseGenerationContext clauseGenerationContext)
    {
      ArgumentUtility.CheckNotNull ("inputParameter", inputParameter);
      ArgumentUtility.CheckNotNull ("expressionToBeResolved", expressionToBeResolved);

      // UnionResultOperator is a query source, so expressions reolve their input parameter with the UnionResultOperator created by this node.
      return QuerySourceExpressionNodeUtility.ReplaceParameterWithReference (this, inputParameter, expressionToBeResolved, clauseGenerationContext);
    }
        protected override QueryModel ApplyNodeSpecificSemantics(QueryModel queryModel, ClauseGenerationContext clauseGenerationContext)
        {
            ArgumentUtility.CheckNotNull ("queryModel", queryModel);

              var resultOperator = CreateResultOperator (clauseGenerationContext);
              queryModel.ResultOperators.Add (resultOperator);
              return queryModel;
        }
Ejemplo n.º 10
0
    public Expression GetResolvedOptionalElementSelector (ClauseGenerationContext clauseGenerationContext)
    {
      if (_optionalElementSelector == null)
        return null;

      return _cachedElementSelector.GetOrCreate (
          r => r.GetResolvedExpression (_optionalElementSelector.Body, _optionalElementSelector.Parameters[0], clauseGenerationContext));
    }
    protected override void ApplyNodeSpecificSemantics (QueryModel queryModel, ClauseGenerationContext clauseGenerationContext)
    {
      //NOTE: Do not seal ApplyNodeSpecificSemantics() in ResultOperatorExpressionNodeBase. It is overridden by e.g. Fetch-operators.
      ArgumentUtility.CheckNotNull ("queryModel", queryModel);

      var resultOperator = CreateResultOperator (clauseGenerationContext);
      queryModel.ResultOperators.Add (resultOperator);
    }
    protected sealed override QueryModel WrapQueryModelAfterEndOfQuery (QueryModel queryModel, ClauseGenerationContext clauseGenerationContext)
    {
      ArgumentUtility.CheckNotNull ("queryModel", queryModel);

      // Result operators can safely be appended to the previous query model even after another result operator, so do not wrap the previous
      // query model.
      return queryModel;
    }
    protected override void ApplyNodeSpecificSemantics (QueryModel queryModel, ClauseGenerationContext clauseGenerationContext)
    {
      ArgumentUtility.CheckNotNull ("queryModel", queryModel);

      var clause = new OrderByClause();
      clause.Orderings.Add (new Ordering (GetResolvedKeySelector (clauseGenerationContext), OrderingDirection.Desc));
      queryModel.BodyClauses.Add (clause);
    }
Ejemplo n.º 14
0
    public override Expression Resolve (ParameterExpression inputParameter, Expression expressionToBeResolved, ClauseGenerationContext clauseGenerationContext)
    {
      ArgumentUtility.CheckNotNull ("inputParameter", inputParameter);
      ArgumentUtility.CheckNotNull ("expressionToBeResolved", expressionToBeResolved);

      // this simply streams its input data to the output without modifying its structure, so we resolve by passing on the data to the previous node
      return Source.Resolve (inputParameter, expressionToBeResolved, clauseGenerationContext);
    }
    public QueryModel Apply (QueryModel queryModel, ClauseGenerationContext clauseGenerationContext)
    {
      if (queryModel != null)
        throw new ArgumentException ("QueryModel has to be null because MainSourceExpressionNode marks the start of a query.", "queryModel");

      var mainFromClause = CreateMainFromClause (clauseGenerationContext);
      var defaultSelectClause = new SelectClause (new QuerySourceReferenceExpression (mainFromClause));
      return new QueryModel (mainFromClause, defaultSelectClause) { ResultTypeOverride = QuerySourceType };
    }
    public QueryModel Apply (QueryModel queryModel, ClauseGenerationContext clauseGenerationContext)
    {
      ArgumentUtility.CheckNotNull ("queryModel", queryModel);

      queryModel = WrapQueryModelAfterEndOfQuery (queryModel, clauseGenerationContext);
      ApplyNodeSpecificSemantics (queryModel, clauseGenerationContext);
      SetResultTypeOverride (queryModel);
      return queryModel;
    }
Ejemplo n.º 17
0
 public override Expression Resolve (
     ParameterExpression inputParameter, Expression expressionToBeResolved, ClauseGenerationContext clauseGenerationContext)
 {
   return QuerySourceExpressionNodeUtility.ReplaceParameterWithReference (
       this, 
       inputParameter, 
       expressionToBeResolved, 
       clauseGenerationContext);
 }
Ejemplo n.º 18
0
    public override Expression Resolve (ParameterExpression inputParameter, Expression expressionToBeResolved, ClauseGenerationContext clauseGenerationContext)
    {
      ArgumentUtility.CheckNotNull ("inputParameter", inputParameter);
      ArgumentUtility.CheckNotNull ("expressionToBeResolved", expressionToBeResolved);

      var convertExpression = Expression.Convert (inputParameter, SearchedItemType);
      var expressionWithCast = ReplacingExpressionVisitor.Replace (inputParameter, convertExpression, expressionToBeResolved);
      return Source.Resolve (inputParameter, expressionWithCast, clauseGenerationContext);
    }
    protected override void ApplyNodeSpecificSemantics (QueryModel queryModel, ClauseGenerationContext clauseGenerationContext)
    {
      ArgumentUtility.CheckNotNull ("queryModel", queryModel);

      var orderByClause = GetOrderByClause (queryModel);
      if (orderByClause == null)
        throw new NotSupportedException ("ThenByDescending expressions must follow OrderBy, OrderByDescending, ThenBy, or ThenByDescending expressions.");

      orderByClause.Orderings.Add (new Ordering (GetResolvedKeySelector (clauseGenerationContext), OrderingDirection.Desc));
    }
        public override Expression Resolve(
            ParameterExpression inputParameter,
            Expression expressionToBeResolved,
            ClauseGenerationContext clauseGenerationContext)
        {
            Check.NotNull(inputParameter, nameof(inputParameter));
            Check.NotNull(expressionToBeResolved, nameof(expressionToBeResolved));

            return Source.Resolve(inputParameter, expressionToBeResolved, clauseGenerationContext);
        }
        protected override void ApplyNodeSpecificSemantics(QueryModel queryModel, ClauseGenerationContext clauseGenerationContext)
        {
            var queryAnnotationResultOperator
                = (QueryAnnotationResultOperator)clauseGenerationContext.GetContextInfo(Source);

            ((IncludeQueryAnnotation)queryAnnotationResultOperator.Annotation)
                .AppendToNavigationPath(_navigationPropertyPathLambda.GetComplexPropertyAccess());

            clauseGenerationContext.AddContextInfo(this, queryAnnotationResultOperator);
        }
    private MainFromClause CreateMainFromClause (ClauseGenerationContext clauseGenerationContext)
    {
      var fromClause = new MainFromClause (
          AssociatedIdentifier,
          QuerySourceElementType,
          ParsedExpression);

      clauseGenerationContext.AddContextInfo (this, fromClause);
      return fromClause;
    }
        protected override QueryModel ApplyNodeSpecificSemantics(QueryModel queryModel, ClauseGenerationContext clauseGenerationContext)
        {
            var includeResultOperator
                = (IncludeResultOperator)clauseGenerationContext.GetContextInfo(Source);

            includeResultOperator.AppendToNavigationPath(_navigationPropertyPathLambda.GetComplexPropertyAccess());

            clauseGenerationContext.AddContextInfo(this, includeResultOperator);

            return queryModel;
        }
Ejemplo n.º 24
0
    public Expression GetResolvedExpression (
        Expression unresolvedExpression, ParameterExpression parameterToBeResolved, ClauseGenerationContext clauseGenerationContext)
    {
      ArgumentUtility.CheckNotNull ("unresolvedExpression", unresolvedExpression);
      ArgumentUtility.CheckNotNull ("parameterToBeResolved", parameterToBeResolved);

      var sourceNode = _currentNode.Source;
      var resolvedExpression = sourceNode.Resolve (parameterToBeResolved, unresolvedExpression, clauseGenerationContext);
      resolvedExpression = TransparentIdentifierRemovingExpressionVisitor.ReplaceTransparentIdentifiers (resolvedExpression);
      return resolvedExpression;
    }
    public override Expression Resolve (ParameterExpression inputParameter, Expression expressionToBeResolved, ClauseGenerationContext clauseGenerationContext)
    {
      ArgumentUtility.CheckNotNull ("inputParameter", inputParameter);
      ArgumentUtility.CheckNotNull ("expressionToBeResolved", expressionToBeResolved);
      ArgumentUtility.CheckNotNull ("clauseGenerationContext", clauseGenerationContext);

      // we modify the structure of the stream of data coming into this node by our result selector,
      // so we first resolve the result selector, then we substitute the result for the inputParameter in the expressionToBeResolved
      var resolvedResultSelector = GetResolvedResultSelector (clauseGenerationContext);
      return ReplacingExpressionTreeVisitor.Replace (inputParameter, resolvedResultSelector, expressionToBeResolved);
    }
    protected override QueryModel ApplyNodeSpecificSemantics (QueryModel queryModel, ClauseGenerationContext clauseGenerationContext)
    {
      var previousFetchRequest = clauseGenerationContext.GetContextInfo (Source) as FetchRequestBase;
      if (previousFetchRequest == null)
        throw new ParserException ("ThenFetchMany must directly follow another Fetch request.");

      FetchRequestBase innerFetchRequest = new FetchManyRequest (RelationMember);
      innerFetchRequest = previousFetchRequest.GetOrAddInnerFetchRequest (innerFetchRequest);
      clauseGenerationContext.AddContextInfo (this, innerFetchRequest);

      return queryModel;
    }
Ejemplo n.º 27
0
    public Expression Resolve (ParameterExpression inputParameter, Expression expressionToBeResolved, ClauseGenerationContext clauseGenerationContext)
    {
      ArgumentUtility.CheckNotNull ("inputParameter", inputParameter);
      ArgumentUtility.CheckNotNull ("expressionToBeResolved", expressionToBeResolved);

      // query sources resolve into references that point back to the respective clauses
      return QuerySourceExpressionNodeUtility.ReplaceParameterWithReference (
          this, 
          inputParameter, 
          expressionToBeResolved, 
          clauseGenerationContext);
    }
Ejemplo n.º 28
0
 public Expression GetResolvedResultSelector (ClauseGenerationContext clauseGenerationContext)
 {
   return _cachedResultSelector.GetOrCreate (
       r => r.GetResolvedExpression (
           QuerySourceExpressionNodeUtility.ReplaceParameterWithReference (
               this,
               _resultSelector.Parameters[1],
               _resultSelector.Body,
               clauseGenerationContext),
           _resultSelector.Parameters[0],
           clauseGenerationContext));
 }
        protected override ResultOperatorBase CreateResultOperator(ClauseGenerationContext clauseGenerationContext)
        {
            var navigationPropertyPath
                = Source.Resolve(
                    _navigationPropertyPathLambda.Parameters[0],
                    _navigationPropertyPathLambda.Body,
                    clauseGenerationContext);

            var includeResultOperator = new IncludeResultOperator(navigationPropertyPath);

            clauseGenerationContext.AddContextInfo(this, includeResultOperator);

            return includeResultOperator;
        }
 /// <summary>
 /// Gets the <see cref="IQuerySource"/> corresponding to the given <paramref name="node"/>, throwing an <see cref="InvalidOperationException"/>
 /// if no such clause has been registered in the given <paramref name="context"/>.
 /// </summary>
 /// <param name="node">The node for which the <see cref="IQuerySource"/> should be returned.</param>
 /// <param name="context">The clause generation context.</param>
 /// <returns>The <see cref="IQuerySource"/> corresponding to <paramref name="node"/>.</returns>
 public static IQuerySource GetQuerySourceForNode (IQuerySourceExpressionNode node, ClauseGenerationContext context)
 {
   try
   {
     return (IQuerySource) context.GetContextInfo (node);
   }
   catch (KeyNotFoundException ex)
   {
     var message = string.Format (
         "Cannot retrieve an IQuerySource for the given {0}. Be sure to call Apply before calling methods that require IQuerySources, and pass in "
         + "the same QuerySourceClauseMapping to both.",
         node.GetType().Name);
     throw new InvalidOperationException (message, ex);
   }
 }
Ejemplo n.º 31
0
 public override Expression Resolve(
     ParameterExpression inputParameter, Expression expressionToBeResolved, ClauseGenerationContext clauseGenerationContext)
 {
     // this simply streams its input data to the output without modifying its structure, so we resolve by passing on the data to the previous node
     return(Source.Resolve(inputParameter, expressionToBeResolved, clauseGenerationContext));
 }
 protected override ResultOperatorBase CreateResultOperator(ClauseGenerationContext clauseGenerationContext)
 {
     return(new AggregateFromSeedResultOperator(Seed, GetResolvedFunc(clauseGenerationContext), OptionalResultSelector));
 }
Ejemplo n.º 33
0
 protected override void ApplyNodeSpecificSemantics(QueryModel queryModel, ClauseGenerationContext clauseGenerationContext)
 {
     ArgumentUtility.CheckNotNull("queryModel", queryModel);
     queryModel.SelectClause.Selector = GetResolvedSelector(clauseGenerationContext);
 }
Ejemplo n.º 34
0
 protected abstract QueryModel ApplyNodeSpecificSemantics(QueryModel queryModel, ClauseGenerationContext clauseGenerationContext);
 public Expression GetResolvedPredicate(ClauseGenerationContext clauseGenerationContext)
 {
     return(_cachedPredicate.GetOrCreate(r => r.GetResolvedExpression(Predicate.Body, Predicate.Parameters[0], clauseGenerationContext)));
 }
 public LambdaExpression GetResolvedFunc(ClauseGenerationContext clauseGenerationContext)
 {
     // '(total, current) => total + current' becomes 'total => total + [current]'
     return(_cachedFunc.GetOrCreate(
                r => Expression.Lambda(r.GetResolvedExpression(Func.Body, Func.Parameters[1], clauseGenerationContext), Func.Parameters[0])));
 }
 public override Expression Resolve(ParameterExpression inputParameter, Expression expressionToBeResolved, ClauseGenerationContext clauseGenerationContext)
 {
     throw CreateResolveNotSupportedException();
 }
Ejemplo n.º 38
0
        public override Expression Resolve(ParameterExpression inputParameter, Expression expressionToBeResolved, ClauseGenerationContext clauseGenerationContext)
        {
            ArgumentUtility.CheckNotNull("inputParameter", inputParameter);
            ArgumentUtility.CheckNotNull("expressionToBeResolved", expressionToBeResolved);

            // this simply streams its input data to the output without modifying its structure, so we resolve by passing on the data to the previous node
            return(Source.Resolve(inputParameter, expressionToBeResolved, clauseGenerationContext));
        }
Ejemplo n.º 39
0
        protected override QueryModel ApplyNodeSpecificSemantics(QueryModel queryModel, ClauseGenerationContext clauseGenerationContext)
        {
            ArgumentUtility.CheckNotNull("queryModel", queryModel);

            var resolvedCollectionSelector = GetResolvedCollectionSelector(clauseGenerationContext);
            var clause = new AdditionalFromClause(ResultSelector.Parameters[1].Name, ResultSelector.Parameters[1].Type, resolvedCollectionSelector);

            queryModel.BodyClauses.Add(clause);

            clauseGenerationContext.AddContextInfo(this, clause);

            var selectClause = queryModel.SelectClause;

            selectClause.Selector = GetResolvedResultSelector(clauseGenerationContext);

            return(queryModel);
        }
Ejemplo n.º 40
0
 protected override ResultOperatorBase CreateResultOperator(ClauseGenerationContext clauseGenerationContext)
 {
     return(new IntersectResultOperator(Source2));
 }
 protected abstract ResultOperatorBase CreateResultOperator(ClauseGenerationContext clauseGenerationContext);
Ejemplo n.º 42
0
 protected override ResultOperatorBase CreateResultOperator(ClauseGenerationContext clauseGenerationContext)
 {
     return(new OfTypeResultOperator(SearchedItemType));
 }
Ejemplo n.º 43
0
        /// <summary>
        /// Wraps the <paramref name="queryModel"/> into a subquery after a node that indicates the end of the query (
        /// <see cref="ResultOperatorExpressionNodeBase"/> or <see cref="GroupByExpressionNode"/>). Override this method
        /// when implementing a <see cref="IExpressionNode"/> that does not need a subquery to be created if it occurs after the query end.
        /// </summary>
        /// <remarks>
        /// <para>
        /// When an ordinary node follows a result operator or group node, it cannot simply append its clauses to the <paramref name="queryModel"/>
        /// because semantically, the result operator (or grouping) must be executed _before_ the clause. Therefore, in such scenarios, we wrap
        /// the current query model into a <see cref="SubQueryExpression"/> that we put into the <see cref="MainFromClause"/> of a new
        /// <see cref="QueryModel"/>.
        /// </para>
        /// <para>
        /// This method also changes the <see cref="Source"/> of this node because logically, all <see cref="Resolve"/> operations must be handled
        /// by the new <see cref="MainFromClause"/> holding the <see cref="SubQueryExpression"/>. For example, consider the following call chain:
        /// <code>
        /// MainSource (...)
        ///   .Select (x => x)
        ///   .Distinct ()
        ///   .Select (x => x)
        /// </code>
        ///
        /// Naively, the last Select node would resolve (via Distinct and Select) to the <see cref="MainFromClause"/> created by the initial MainSource.
        /// After this method is executed, however, that <see cref="MainFromClause"/> is part of the sub query, and a new <see cref="MainFromClause"/>
        /// has been created to hold it. Therefore, we replace the chain as follows:
        /// <code>
        /// MainSource (MainSource (...).Select (x => x).Distinct ())
        ///   .Select (x => x)
        /// </code>
        ///
        /// Now, the last Select node resolves to the new <see cref="MainFromClause"/>.
        /// </para>
        /// </remarks>
        protected virtual QueryModel WrapQueryModelAfterEndOfQuery(QueryModel queryModel, ClauseGenerationContext clauseGenerationContext)
        {
            ArgumentUtility.CheckNotNull("queryModel", queryModel);

            var sourceAsResultOperatorNode = Source as ResultOperatorExpressionNodeBase;

            if (sourceAsResultOperatorNode != null)
            {
                return(WrapQueryModel(queryModel, sourceAsResultOperatorNode.AssociatedIdentifier, clauseGenerationContext));
            }
            else
            {
                return(queryModel);
            }
        }
Ejemplo n.º 44
0
        protected override QueryModel ApplyNodeSpecificSemantics(QueryModel queryModel, ClauseGenerationContext clauseGenerationContext)
        {
            var clause = new WhereClause(GetResolvedPredicate(clauseGenerationContext));

            queryModel.BodyClauses.Add(clause);
            return(queryModel);
        }
Ejemplo n.º 45
0
        private QueryModel WrapQueryModel(QueryModel queryModel, string associatedIdentifier, ClauseGenerationContext clauseGenerationContext)
        {
            var subQueryExpression = new SubQueryExpression(queryModel);

            // change the Source of this node so that Resolve will later correctly go to the new main from clause we create for the sub query
            var newMainSourceNode = new MainSourceExpressionNode(associatedIdentifier, subQueryExpression);

            Source = newMainSourceNode;

            return(newMainSourceNode.Apply(null, clauseGenerationContext));
        }
 protected override ResultOperatorBase CreateResultOperator(ClauseGenerationContext clauseGenerationContext)
 {
     return(new ContainsResultOperator(Item));
 }
Ejemplo n.º 47
0
 protected override ResultOperatorBase CreateResultOperator(ClauseGenerationContext clauseGenerationContext)
 {
     return(new MaxResultOperator());
 }
Ejemplo n.º 48
0
 public abstract Expression Resolve(
     ParameterExpression inputParameter, Expression expressionToBeResolved, ClauseGenerationContext clauseGenerationContext);
        protected override ResultOperatorBase CreateResultOperator(ClauseGenerationContext clauseGenerationContext)
        {
            var castItemType = CastItemType;

            return(new CastResultOperator(castItemType));
        }
        protected override QueryModel ApplyNodeSpecificSemantics(QueryModel queryModel, ClauseGenerationContext clauseGenerationContext)
        {
            ArgumentUtility.CheckNotNull("queryModel", queryModel);

            var clause = new WhereClause(GetResolvedPredicate(clauseGenerationContext));

            queryModel.BodyClauses.Add(clause);
            return(queryModel);
        }
Ejemplo n.º 51
0
        public override Expression Resolve(ParameterExpression inputParameter, Expression expressionToBeResolved, ClauseGenerationContext clauseGenerationContext)
        {
            ArgumentUtility.CheckNotNull("inputParameter", inputParameter);
            ArgumentUtility.CheckNotNull("expressionToBeResolved", expressionToBeResolved);

            var convertExpression  = Expression.Convert(inputParameter, SearchedItemType);
            var expressionWithCast = ReplacingExpressionTreeVisitor.Replace(inputParameter, convertExpression, expressionToBeResolved);

            return(Source.Resolve(inputParameter, expressionWithCast, clauseGenerationContext));
        }
Ejemplo n.º 52
0
 protected override ResultOperatorBase CreateResultOperator(ClauseGenerationContext clauseGenerationContext)
 {
     return(new ExceptResultOperator(_source2));
 }
        protected override QueryModel ApplyNodeSpecificSemantics(QueryModel queryModel, ClauseGenerationContext clauseGenerationContext)
        {
            ArgumentUtility.CheckNotNull("queryModel", queryModel);

            var clause = new OrderByClause();

            clause.Orderings.Add(new Ordering(GetResolvedKeySelector(clauseGenerationContext), OrderingDirection.Asc));
            queryModel.BodyClauses.Add(clause);

            return(queryModel);
        }
Ejemplo n.º 54
0
 protected override ResultOperatorBase CreateResultOperator(ClauseGenerationContext clauseGenerationContext)
 {
     return(new LastResultOperator(ParsedExpression.Method.Name.EndsWith("OrDefault")));
 }
 public Expression GetResolvedKeySelector(ClauseGenerationContext clauseGenerationContext)
 {
     return(_cachedSelector.GetOrCreate(r => r.GetResolvedExpression(KeySelector.Body, KeySelector.Parameters[0], clauseGenerationContext)));
 }
        protected override QueryModel ApplyNodeSpecificSemantics(QueryModel queryModel, ClauseGenerationContext clauseGenerationContext)
        {
            ArgumentUtility.CheckNotNull("queryModel", queryModel);
            var orderByClause = GetOrderByClause(queryModel);

            if (orderByClause == null)
            {
                throw new ParserException("ThenByDescending expressions must follow OrderBy, OrderByDescending, ThenBy, or ThenByDescending expressions.");
            }

            orderByClause.Orderings.Add(new Ordering(GetResolvedKeySelector(clauseGenerationContext), OrderingDirection.Asc));
            return(queryModel);
        }
        protected sealed override QueryModel WrapQueryModelAfterEndOfQuery(QueryModel queryModel, ClauseGenerationContext clauseGenerationContext)
        {
            ArgumentUtility.CheckNotNull("queryModel", queryModel);

            // Result operators can safely be appended to the previous query model even after another result operator, so do not wrap the previous
            // query model.
            return(queryModel);
        }
Ejemplo n.º 58
0
 public override Expression Resolve(
     ParameterExpression inputParameter, Expression expressionToBeResolved, ClauseGenerationContext clauseGenerationContext)
 {
     // no data streams out from this node, so we cannot resolve any expressions
     throw CreateResolveNotSupportedException();
 }
Ejemplo n.º 59
0
 public Expression Resolve(ParameterExpression inputParameter, Expression expressionToBeResolved, ClauseGenerationContext clauseGenerationContext)
 {
     // query sources resolve into references that point back to the respective clauses
     return(QuerySourceExpressionNodeUtility.ReplaceParameterWithReference(
                this,
                inputParameter,
                expressionToBeResolved,
                clauseGenerationContext));
 }