src/Inflatable/LinqExpression/WhereClauses/BinaryOperator.cs
/// <summary>
/// Optimizes the operator based on the mapping source.
/// </summary>
/// <param name="mappingSource">The mapping source.</param>
/// <returns></returns>
Optimizes the operator based on the mapping source.
Optimizes the operator based on the mapping source .
public IOperator Optimize(IMappingSource mappingSource)
        {
            Left = Left.Optimize(mappingSource);
            Right = Right.Optimize(mappingSource);
            if (Left is null || Right is null)
            {
                return (Left ?? Right)!;
            }
            if (Operator == ExpressionType.And
                || Operator == ExpressionType.Or
                || Operator == ExpressionType.OrElse
                || Operator == ExpressionType.AndAlso)
            {
                if (Left.TypeCode != typeof(bool))
                {
                    return Right;
                }
                if (Right.TypeCode != typeof(bool))
                {
                    return Left;
                }
            }
            return this;
        }
public IOperator Optimize ( IMappingSource mappingSource ) { Left = Left . Optimize ( mappingSource ) ; Right = Right . Optimize ( mappingSource ) ; if ( Left is null || Right is null ) { return ( Left ?? Right ) ! ; } if ( Operator == ExpressionType . And || Operator == ExpressionType . Or || Operator == ExpressionType . OrElse || Operator == ExpressionType . AndAlso ) { if ( Left . TypeCode != typeof ( bool ) ) { return Right ; } if ( Right . TypeCode != typeof ( bool ) ) { return Left ; } } return this ; }
Optimizes the operator based on the mapping source.
Optimizes the operator based on the mapping source .
None
mappingSource
IMappingSource
The mapping source.
The mapping source .