/// <summary>
 /// This query-builder method creates a new query whose results are all of
 /// the results of this query, plus all of the results of the other query,
 /// without duplicates (i.e., results are unique).
 /// </summary>
 /// <param name="query"> A query representing the results to add. </param>
 /// <returns> a new ObjectQuery instance. </returns>
 /// <exception cref="T:System.ArgumentNullException">If the query parameter is null.</exception>
 public ObjectQuery <T> Union(ObjectQuery <T> query)
 {
     Check.NotNull <ObjectQuery <T> >(query, nameof(query));
     if (ObjectQuery <T> .IsLinqQuery((ObjectQuery)this) || ObjectQuery <T> .IsLinqQuery((ObjectQuery)query))
     {
         return((ObjectQuery <T>) this.Union <T>((IEnumerable <T>)query));
     }
     return(new ObjectQuery <T>(EntitySqlQueryBuilder.Union(this.QueryState, query.QueryState)));
 }
        /// <summary>
        ///   This query-builder method creates a new query whose results are all of
        ///   the results of this query, plus all of the results of the other query,
        ///   without duplicates (i.e., results are unique).
        /// </summary>
        /// <param name="query">
        ///   A query representing the results to add.
        /// </param>
        /// <returns>
        ///   a new ObjectQuery instance.
        /// </returns>
        /// <exception cref="ArgumentNullException">
        ///   If the query parameter is null.
        /// </exception>
        public ObjectQuery <T> Union(ObjectQuery <T> query)
        {
            EntityUtil.CheckArgumentNull(query, "query");

            if (IsLinqQuery(this) || IsLinqQuery(query))
            {
                return((ObjectQuery <T>)Queryable.Union(this, query));
            }
            return(new ObjectQuery <T>(EntitySqlQueryBuilder.Union(this.QueryState, query.QueryState)));
        }