/// <summary> /// Internal method for better FetchExpression paging performance /// </summary> internal static void NextPage(this FetchExpression query, XDocument xDocument, string pagingCookie) { /// No paging mean PageInfo.Page = 0 /// for FetchXml it mean no "page" attribute or 0 value string page = xDocument.Root.Attribute("page")?.Value; int pageNumber = page != null?int.Parse(page) : 0; xDocument.Root.SetAttributeValue("paging-cookie", pagingCookie); xDocument.Root.SetAttributeValue("page", ++pageNumber); query.Query = xDocument.ToString(); }
/// <summary> /// Sets FetchExpression paging parameters to next page /// </summary> public static void NextPage(this FetchExpression query, string pagingCookie) { XDocument xDocument = XDocument.Parse(query.Query); NextPage(query, xDocument, pagingCookie); }