コード例 #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);
            }
        }
コード例 #2
0
        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;
 }