Remotion.Linq.SqlBackend.SqlStatementModel.SqlStatementBuilder.RecalculateDataInfo C# (CSharp) Méthode

RecalculateDataInfo() public méthode

public RecalculateDataInfo ( Expression previousSelectProjection ) : void
previousSelectProjection System.Linq.Expressions.Expression
Résultat void
    public void RecalculateDataInfo (Expression previousSelectProjection)
    {
      if (SelectProjection.Type != previousSelectProjection.Type) // TODO: Consider removing this check and the parameter
      {
        var sequenceInfo = DataInfo as StreamedSequenceInfo;
        if (sequenceInfo != null)
          DataInfo = new StreamedSequenceInfo (typeof (IQueryable<>).MakeGenericType (SelectProjection.Type), SelectProjection);

        var singleValueInfo = DataInfo as StreamedSingleValueInfo;
        if (singleValueInfo != null)
          DataInfo = new StreamedSingleValueInfo (SelectProjection.Type, singleValueInfo.ReturnDefaultWhenEmpty);

        // For scalar queries, the DataInfo never needs to be recalculated.
      }
    }

Usage Example

    public SqlStatement VisitSqlStatement (SqlStatement sqlStatement, SqlExpressionContext expressionContext)
    {
      ArgumentUtility.CheckNotNull ("sqlStatement", sqlStatement);

      if (expressionContext == SqlExpressionContext.PredicateRequired)
        throw new InvalidOperationException ("A SqlStatement cannot be used as a predicate.");

      var statementBuilder = new SqlStatementBuilder (sqlStatement);

      var newSelectProjection = _stage.ApplyContext (sqlStatement.SelectProjection, expressionContext, _mappingResolutionContext);
      statementBuilder.SelectProjection = newSelectProjection;
      statementBuilder.RecalculateDataInfo (sqlStatement.SelectProjection);

      var newSqlStatement = statementBuilder.GetSqlStatement();
      return newSqlStatement.Equals (sqlStatement) ? sqlStatement : newSqlStatement;
    }
All Usage Examples Of Remotion.Linq.SqlBackend.SqlStatementModel.SqlStatementBuilder::RecalculateDataInfo