Esempio n. 1
0
        /// <summary>
        /// And
        /// </summary>
        /// <param name="where"></param>
        /// <returns></returns>
        public WhereClip And(WhereClip where)
        {
            if (WhereClip.IsNullOrEmpty(this) && WhereClip.IsNullOrEmpty(where))
            {
                return(All);
            }

            if (WhereClip.IsNullOrEmpty(where))
            {
                return(this);
            }
            if (WhereClip.IsNullOrEmpty(this))
            {
                return(where);
            }



            WhereClip andwhere = new WhereClip(string.Concat(this.Where, " AND ", where.Where));

            andwhere.parameters.AddRange(this.Parameters);
            andwhere.parameters.AddRange(where.Parameters);


            return(andwhere);
        }
Esempio n. 2
0
        /// <summary>
        /// Or
        /// </summary>
        /// <param name="leftWhere"></param>
        /// <param name="rightWhere"></param>
        /// <returns></returns>
        public static WhereClip operator |(WhereClip leftWhere, WhereClip rightWhere)
        {
            if (WhereClip.IsNullOrEmpty(leftWhere))
            {
                return(rightWhere);
            }

            return(leftWhere.Or(rightWhere));
        }
Esempio n. 3
0
        /// <summary>
        /// Or
        /// </summary>
        /// <param name="where"></param>
        /// <returns></returns>
        public WhereClip Or(WhereClip where)
        {
            if (WhereClip.IsNullOrEmpty(this) && WhereClip.IsNullOrEmpty(where))
            {
                return(All);
            }

            if (WhereClip.IsNullOrEmpty(where))
            {
                return(this);
            }
            if (WhereClip.IsNullOrEmpty(this))
            {
                return(where);
            }

            WhereClip orwhere = new WhereClip(string.Concat(this.Where, " OR ", where.Where));

            orwhere.parameters.AddRange(this.Parameters);
            orwhere.parameters.AddRange(where.Parameters);


            return(orwhere);
        }