Last week (MIX 2011), Microsoft released the second Visual Studio Async CTP and I’ve decided to give it a try and implement one of my blog posts related to our Silverlight Data Virtualization with WCF RIA Services.
To do this I’ve made two extension methods for DomainContext: LoadAsync<T>() and CountAsync<T>().
The first method will return the entities from a EntityQuery<T> and the second will return asynchronously count for the specified query.
And here is the result:
As you can see the only hardcoded value here is LoadSize for the virtual collection and everything else is retrieved and applied asynchronously using async and await keywords.