Esempio n. 1
0
        // Union -------------------------------------

        /// <summary>
        ///
        /// </summary>
        /// <param name="unionClause">The union clause to consider.</param>
        public IDbSingleQuery Union(DbQueryUnionKind kind, IDbSingleQuery query)
        {
            if (UnionClauses == null)
            {
                UnionClauses = new List <DbQueryUnionClause>();
            }
            UnionClauses.Add(new DbQueryUnionClause()
            {
                Kind = kind, Query = query
            });

            return(this);
        }
Esempio n. 2
0
        // ------------------------------------------
        // ACCESSORS
        // ------------------------------------------

        #region Accessors

        /// <summary>
        /// Clones this instance.
        /// </summary>
        /// <returns>Returns the cloned instance.</returns>
        public override object Clone(params string[] areas)
        {
            var clone = base.Clone(areas) as DbSingleQuery;

            clone.Fields           = Fields?.Select(p => p.Clone <DbField>()).ToList();
            clone.UnionClauses     = UnionClauses?.Select(p => p?.Clone <DbQueryUnionClause>()).ToList();
            clone.FromClause       = FromClause?.Clone <DbQueryFromClause>();
            clone.WhereClause      = WhereClause?.Clone <DbQueryWhereClause>();
            clone.GroupByClause    = GroupByClause?.Clone <DbQueryGroupByClause>();
            clone.HavingClause     = HavingClause?.Clone <DbQueryHavingClause>();
            clone.OrderByClause    = OrderByClause?.Clone <DbQueryOrderByClause>();
            clone.ReturnedIdFields = ReturnedIdFields?.Select(p => p.Clone <DbField>()).ToList();

            return(clone);
        }