Remotion.Linq.SqlBackend.MappingResolution.SqlContextExpressionVisitor.VisitConstantExpression C# (CSharp) Метод

VisitConstantExpression() защищенный Метод

protected VisitConstantExpression ( ConstantExpression expression ) : Expression
expression System.Linq.Expressions.ConstantExpression
Результат System.Linq.Expressions.Expression
    protected override Expression VisitConstantExpression (ConstantExpression expression)
    {
      // Always convert boolean constants to int constants because in the database, there are no boolean constants
      
      if (BooleanUtility.IsBooleanType (expression.Type))
      {
        var intType = BooleanUtility.GetMatchingIntType (expression.Type);
        var convertedExpression = expression.Value == null
                                      ? Expression.Constant (null, intType)
                                      : expression.Value.Equals (true)
                                            ? Expression.Constant (1, intType)
                                            : Expression.Constant (0, intType);
        return new SqlConvertedBooleanExpression (convertedExpression);
      }
      
      return expression; // rely on VisitExpression to apply correct semantics
    }