Search code examples
entity-frameworkasynchronousexecutequery

Asynchronous data loading in Entity-Framework?


Did anyone hear about asynchronous executing of an EF query?

I want my items control to be filled right when the form loads and the user should be able to view the list while the rest of the items are still being loaded.

Maybe by auto-splitting the execution in bulks of items (i.e. few queries for each execution) all in same connection.

I posted a feature suggestion to Microsoft, please share them with your ideas as well.


Solution

  • Not wanting to sound like a commercial, but I noticed that the latest DevExpress grid gives features like this in their WPF grid. Essentially you want to load visible-count items first, then load the rest in a background thread so your UI isn't freezing up. The background thread should probably load another page at a time and make them available to the UI thread.

    It's something you would want to think about carefully and make sure you get it right, or simply buy a control that does the hard work for you.