/// <summary> /// Clones the SelectQuery /// </summary> /// <returns>A new instance of SelectQuery which is exactly the same as the current one.</returns> public SelectQuery Clone() { var newQuery = new SelectQuery { columns = new SelectColumnCollection(columns), orderByTerms = new OrderByTermCollection(orderByTerms), groupByTerms = new GroupByTermCollection(groupByTerms), wherePhrase = wherePhrase.Clone(), fromClause = fromClause.Clone(), top = top, distinct = distinct, tableSpace = tableSpace, parameters = new ParameterCollection(parameters) }; var newSettings = new PageSettings { PageIndex = pageSettings.PageIndex, PageSize = pageSettings.PageSize }; newQuery.pageSettings = newSettings; return(newQuery); }