August 14, 2024
Following on from Dynamics CRM Paging Cookies – Some gotchas!, here is a helper class we use for all our paging needs. An example of its usage: [sourcecode language=”csharp”] const string fetchXml = @” <fetch mapping=’logical’ count=’5000′ version=’1.0′ page='{0}’ {1}> <entity name=’account’> <attribute name=’name’ /> </entity> </fetch>”; var accounts = new PagedRetriever<Tuple<Guid, string>>( entity => Tuple.Create( entity.Id, (string)entity.Attributes[“name”]), (page, cookie) => String.Format(fetchXml, page, cookie)) .GetData(service); [/sourcecode] The utility class has a couple of nice features: Laziness – Extra pages […]







