Remotion.Linq.SqlBackend.SqlStatementModel.SqlSubStatementExpression.ConvertValueStatementToSequenceStatement C# (CSharp) Méthode

ConvertValueStatementToSequenceStatement() private méthode

private ConvertValueStatementToSequenceStatement ( ) : SqlStatement
Résultat SqlStatement
    private SqlStatement ConvertValueStatementToSequenceStatement ()
    {
      var newDataInfo = new StreamedSequenceInfo (typeof (IEnumerable<>).MakeGenericType (SqlStatement.DataInfo.DataType), SqlStatement.SelectProjection);

      var adjustedStatementBuilder = new SqlStatementBuilder (SqlStatement) { DataInfo = newDataInfo };
      if (SqlStatement.DataInfo is StreamedSingleValueInfo && SqlStatement.SqlTables.Count!=0)
      {
        // A sub-statement might use a different TopExpression than 1 (or none at all) in order to provoke a SQL error when more than one item is 
        // returned. When we convert the statement to a sequence statement, however, we must ensure that the exact "only 1 value is returned" 
        // semantics is ensured because we can't provoke a SQL error (but instead would return strange result sets).
        adjustedStatementBuilder.TopExpression = new SqlLiteralExpression (1);
      }

      return adjustedStatementBuilder.GetSqlStatement();
    }
  }