예제 #1
0
        void DefinePredicate(IComparisonOperator op, BinaryExpression X)
        {
            if (!SpecifiesMemberPredicate(X))
            {
                return;
            }

            var member = X.TryGetAccessedMember();

            if (!member)
            {
                return;
            }

            var value = X.GetValue();

            if (!value)
            {
                return;
            }

            var predicate = MemberValuePredicate.Define(op, member.Require(), value.Require());

            if (CurrentJunction != null)
            {
                CurrentJunction.Item2.Criteria.Add(predicate);
            }
        }
        public void Register(IComparisonOperator @operator)
        {
            Require.NotNull(@operator, "operator");

            if (!_operatorsByName.TryAdd(@operator.Name, @operator))
            {
                throw new InvalidOperationException("A comparison operator with name '" + @operator.Name + "' already exists.");
            }
            else
            {
                if (!String.IsNullOrWhiteSpace(@operator.Alias))
                {
                    if (!_operatorsByName.TryAdd(@operator.Alias, @operator))
                    {
                        IComparisonOperator temp;
                        _operatorsByName.TryRemove(@operator.Name, out temp);

                        throw new InvalidOperationException("Comparison operator alias '" + @operator.Alias + "' already exists.");
                    }
                }
            }
        }
예제 #3
0
 public ComparisonOperatorModel(IComparisonOperator @operator)
 {
     Name = @operator.Name;
     Alias = @operator.Alias;
     DisplayName = String.IsNullOrWhiteSpace(@operator.Alias) ? Name : Alias;
 }
예제 #4
0
 public ComparisonOperatorModel(IComparisonOperator @operator)
 {
     Name        = @operator.Name;
     Alias       = @operator.Alias;
     DisplayName = String.IsNullOrWhiteSpace(@operator.Alias) ? Name : Alias;
 }