Exemplo n.º 1
0
        public StorageComparisonExpression(StorageQueryOperand left, StorageQueryOperand right, ExpressionType bNodeType) : base(left, right)
        {
            if (left is StorageQueryEntityMember && right is StorageQueryEntityMember)
            {
                var bleft = left;
                throw new InvalidOperationException("The operands of a Comparsion cant no be both EntityAccess");
            }

            if (left is StorageQueryConstantMember && right is StorageQueryConstantMember)
            {
                var bleft = left;
                throw new InvalidOperationException("The operands of a Comparsion cant no be both Constant");
            }

            switch (bNodeType)
            {
            case ExpressionType.Equal: Operator = QueryComparisonOperator.Equal;
                break;

            case ExpressionType.NotEqual:
                Operator = QueryComparisonOperator.NotEqual;
                break;

            case ExpressionType.GreaterThan:
                Operator = QueryComparisonOperator.GreaterThan;
                break;

            case ExpressionType.GreaterThanOrEqual:
                Operator = QueryComparisonOperator.GreaterThanOrEqual;
                break;

            case ExpressionType.LessThan:
                Operator = QueryComparisonOperator.LessThan;
                break;

            case ExpressionType.LessThanOrEqual:
                Operator = QueryComparisonOperator.LessThanOrEqual;
                break;

            default:
                throw new StorageArgumentOutOfRangeException(nameof(bNodeType), $"Operator {bNodeType} not supported");
            }
        }
        public StorageLogicalExpression(StorageQueryOperand left, StorageQueryOperand right, ExpressionType bNodeType) : base(left, right)
        {
            switch (bNodeType)
            {
            case ExpressionType.AndAlso:
                Operator = QueryLogicalOperator.And;
                break;

            case ExpressionType.OrElse:
                Operator = QueryLogicalOperator.Or;
                break;

            case ExpressionType.Not:
                Operator = QueryLogicalOperator.Not;
                break;

            default:
                throw new StorageArgumentOutOfRangeException(nameof(bNodeType), $"Operator {bNodeType} not supported");
            }
        }
 public StorageLogicalExpression(StorageQueryOperand left, StorageQueryOperand right, QueryLogicalOperator operatorNode) : base(left, right)
 {
     Operator = operatorNode;
 }