Exemplo n.º 1
0
        private static IExpression GetConditionExpression(IStatement statement, Condition condition)
        {
            if (condition == null)
            {
                throw new ArgumentNullException(nameof(condition));
            }

            var field = statement.GetOperandExpression(condition.Field, out _);

            if (condition.Value == null)
            {
                return(condition.Operator switch
                {
                    ConditionOperator.Like => Expression.Equal(field, null),
                    ConditionOperator.Equal => Expression.Equal(field, null),
                    ConditionOperator.NotEqual => Expression.NotEqual(field, null),
                    _ => throw new DataException($"The specified '{condition.Name}' parameter value of the type {condition.Operator} condition is null."),
                });