public static Query Combine(Query firstQuery, Query secondQuery) { return new Query { Where = Where.Combine(firstQuery.Where, secondQuery.Where), OrderBy = OrderBy.Combine(firstQuery.OrderBy, secondQuery.OrderBy), GroupBy = GroupBy.Combine(firstQuery.GroupBy, secondQuery.GroupBy) }; }
public static SPQuery Combine(this SPQuery spQuery, Query query) { if (spQuery != null) { Query existingQuery = Query.GetFromSPQuery(spQuery); spQuery.Query = Query.Combine(existingQuery, query).ToString(false); } return spQuery; }
public static Query Parse(XElement existingQuery) { Query query = new Query(); if (existingQuery != null && (existingQuery.HasElements && string.Equals(existingQuery.Name.LocalName, QueryTag, StringComparison.InvariantCultureIgnoreCase))) { XElement existingWhere = existingQuery.Elements().SingleOrDefault(el => string.Equals(el.Name.LocalName, "Where", StringComparison.InvariantCultureIgnoreCase)); if (existingWhere != null) query.Where = new Where(existingWhere); XElement existingOrderBy = existingQuery.Elements().SingleOrDefault(el => string.Equals(el.Name.LocalName, "OrderBy", StringComparison.InvariantCultureIgnoreCase)); if (existingOrderBy != null) query.OrderBy = new OrderBy(existingOrderBy); XElement existingGroupBy = existingQuery.Elements().SingleOrDefault(el => string.Equals(el.Name.LocalName, "GroupBy", StringComparison.InvariantCultureIgnoreCase)); if (existingGroupBy != null) query.GroupBy = new GroupBy(existingGroupBy); } return query; }