public override void VisitResultOperator(ResultOperatorBase resultOperator, QueryModel queryModel, int index) { var streamedDataInfo = resultOperator.GetOutputDataInfo(_streamedSequenceInfo); Func <Expression, Type, ResultOperatorBase, Expression> asyncHandler; if (!_asyncHandlers.TryGetValue(resultOperator.GetType(), out asyncHandler)) { // TODO: Implement the rest... throw new NotImplementedException(); } _expression = asyncHandler(_expression, _streamedSequenceInfo.ResultItemType, resultOperator); _streamedSequenceInfo = streamedDataInfo as StreamedSequenceInfo; }
public override void VisitResultOperator( [NotNull] ResultOperatorBase resultOperator, [NotNull] QueryModel queryModel, int index) { Check.NotNull(resultOperator, "resultOperator"); Check.NotNull(queryModel, "queryModel"); var expression = _queryCompilationContext.ResultOperatorHandler .HandleResultOperator(this, resultOperator, queryModel); if (expression != _expression) { _expression = expression; _streamedSequenceInfo = resultOperator.GetOutputDataInfo(_streamedSequenceInfo) as StreamedSequenceInfo; } }
public override void VisitResultOperator(ResultOperatorBase resultOperator, QueryModel queryModel, int index) { PreviousEvaluationType = CurrentEvaluationType; CurrentEvaluationType = resultOperator.GetOutputDataInfo(PreviousEvaluationType); if (resultOperator is ClientSideTransformOperator) { _serverSide = false; } else { if (!_serverSide) { throw new NotSupportedException("Processing server-side result operator after doing client-side ones. We've got the ordering wrong..."); } } ResultOperatorMap.Process(resultOperator, this, _hqlTree); }
private static IStreamedDataInfo GetOutputDataInfo(ResultOperatorBase resultOperator, IStreamedDataInfo evaluationType) { //ContainsResultOperator contains data integrity check so for `values.Contains(x)` it checks that 'x' is proper type to be used inside 'values.Contains()' //Due to some reasons (possibly NH expression rewritings) those types might be incompatible (known case NH-3155 - group by subquery). So resultOperator.GetOutputDataInfo throws something like: //System.ArgumentException : The items of the input sequence of type 'System.Linq.IGrouping`2[System.Object[],EntityType]' are not compatible with the item expression of type 'System.Int32'. //Parameter name: inputInfo //at Remotion.Linq.Clauses.ResultOperators.ContainsResultOperator.GetOutputDataInfo(StreamedSequenceInfo inputInfo) //But in this place we don't really care about types involving inside expression, all we need to know is operation result which is bool for Contains //So let's skip possible type exception mismatch if it allows to generate proper SQL switch (resultOperator) { case ContainsResultOperator _: case AnyResultOperator _: case AllResultOperator _: return(new StreamedScalarValueInfo(typeof(bool))); } return(resultOperator.GetOutputDataInfo(evaluationType)); }
public override void VisitResultOperator(ResultOperatorBase resultOperator, QueryModel queryModel, int index) { // TODO: sub-queries in result op. expressions // resultOperator // .TransformExpressions(e => // ReplaceClauseReferences(new QueryingExpressionTreeVisitor(this) // .VisitExpression(e))); var streamedDataInfo = resultOperator.GetOutputDataInfo(_streamedSequenceInfo); _expression = Expression.Call( _executeResultOperatorMethodInfo .MakeGenericMethod(_streamedSequenceInfo.ResultItemType, streamedDataInfo.DataType), _expression, Expression.Constant(resultOperator), Expression.Constant(_streamedSequenceInfo)); _streamedSequenceInfo = streamedDataInfo as StreamedSequenceInfo; }
public virtual Expression HandleResultOperator( EntityQueryModelVisitor entityQueryModelVisitor, ResultOperatorBase resultOperator, QueryModel queryModel) { Check.NotNull(entityQueryModelVisitor, "entityQueryModelVisitor"); Check.NotNull(resultOperator, "resultOperator"); Check.NotNull(queryModel, "queryModel"); var streamedDataInfo = resultOperator.GetOutputDataInfo(entityQueryModelVisitor.StreamedSequenceInfo); return (Expression.Call( _executeResultOperatorMethodInfo .MakeGenericMethod( entityQueryModelVisitor.StreamedSequenceInfo.ResultItemType, streamedDataInfo.DataType), entityQueryModelVisitor.Expression, Expression.Constant(resultOperator), Expression.Constant(entityQueryModelVisitor.StreamedSequenceInfo))); }
public override void VisitResultOperator(ResultOperatorBase resultOperator, QueryModel queryModel, int index) { PreviousEvaluationType = CurrentEvaluationType; CurrentEvaluationType = resultOperator.GetOutputDataInfo(PreviousEvaluationType); if (resultOperator is ClientSideTransformOperator) { _serverSide = false; } else { if (!_serverSide) { throw new NotSupportedException("Processing server-side result operator after doing client-side ones. We've got the ordering wrong..."); } } ResultOperatorMap.Process(resultOperator, this, _hqlTree); }
/// <summary> /// Recalculates <see cref="SqlStatementBuilder.DataInfo"/> based on the <paramref name="resultOperator"/> and the /// previous <paramref name="dataInfo"/>. /// </summary> protected void UpdateDataInfo(ResultOperatorBase resultOperator, SqlStatementBuilder sqlStatementBuilder, IStreamedDataInfo dataInfo) { sqlStatementBuilder.DataInfo = resultOperator.GetOutputDataInfo(dataInfo); }