示例#1
0
        /// <summary>
        /// Prepends the DbExpression with the supplied DbExpression using an OR clause.
        /// </summary>
        /// <param name="prepend">The DbExpression to prepend.</param>
        public void PrependOr(DbExpression prepend)
        {
            if (prepend == null)
            {
                throw new ArgumentNullException(nameof(prepend));
            }

            DbExpression orig = new DbExpression(this.LeftTerm, this.Operator, this.RightTerm);
            DbExpression e    = PrependOrClause(prepend, orig);

            LeftTerm  = e.LeftTerm;
            Operator  = e.Operator;
            RightTerm = e.RightTerm;

            return;
        }
示例#2
0
 /// <summary>
 /// A structure in the form of term-operator-term that defines a Boolean expression within a WHERE clause.
 /// </summary>
 /// <param name="left">The left term of the expression; can either be a string term or a nested DbExpression.</param>
 /// <param name="oper">The operator.</param>
 /// <param name="right">The right term of the expression; can either be an object for comparison or a nested DbExpression.</param>
 public DbExpression(object left, DbOperators oper, object right)
 {
     LeftTerm  = left;
     Operator  = oper;
     RightTerm = right;
 }
示例#3
0
        /// <summary>
        /// Prepends a new DbExpression using the supplied left term, operator, and right term using an OR clause.
        /// </summary>
        /// <param name="left">The left term of the expression; can either be a string term or a nested DbExpression.</param>
        /// <param name="oper">The operator.</param>
        /// <param name="right">The right term of the expression; can either be an object for comparison or a nested DbExpression.</param>
        public void PrependOr(object left, DbOperators oper, object right)
        {
            DbExpression e = new DbExpression(left, oper, right);

            PrependOr(e);
        }
示例#4
0
        /// <summary>
        /// Convert a WatsonORM DbOperators to a DatabaseWrapper Core Operators.
        /// </summary>
        /// <param name="oper">WatsonORM DbOperators.</param>
        /// <returns>DatabaseWrapper Core Operators.</returns>
        public static Operators DbOperatorsConverter(DbOperators oper)
        {
            switch (oper)
            {
            case DbOperators.And:
                return(Operators.And);

            case DbOperators.Or:
                return(Operators.Or);

            case DbOperators.Equals:
                return(Operators.Equals);

            case DbOperators.NotEquals:
                return(Operators.NotEquals);

            case DbOperators.In:
                return(Operators.In);

            case DbOperators.NotIn:
                return(Operators.NotIn);

            case DbOperators.Contains:
                return(Operators.Contains);

            case DbOperators.ContainsNot:
                return(Operators.ContainsNot);

            case DbOperators.StartsWith:
                return(Operators.StartsWith);

            case DbOperators.StartsWithNot:
                return(Operators.StartsWithNot);

            case DbOperators.EndsWith:
                return(Operators.EndsWith);

            case DbOperators.EndsWithNot:
                return(Operators.EndsWithNot);

            case DbOperators.GreaterThan:
                return(Operators.GreaterThan);

            case DbOperators.GreaterThanOrEqualTo:
                return(Operators.GreaterThanOrEqualTo);

            case DbOperators.LessThan:
                return(Operators.LessThan);

            case DbOperators.LessThanOrEqualTo:
                return(Operators.LessThanOrEqualTo);

            case DbOperators.IsNull:
                return(Operators.IsNull);

            case DbOperators.IsNotNull:
                return(Operators.IsNotNull);

            default:
                throw new ArgumentException("Unknown operator '" + oper.ToString() + "'.");
            }
        }