Question

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.

Was it helpful?

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.

OTHER TIPS

I take from your link that this is a web app. Is that correct?

A Query must complete and return data before rendering can begin. An EF feature will not help you here. Rather. look at breaking up your process into several processes that can be done at once.

Keep in mind that ASP.NET cannot return a response to a browser if it is not done rendering the HTML.

Let me assume you are executing a single query, getting the results back and displaying them to a page.

Best option: Page your results. if you Have 4000 records, show the first 50. If you show 200+ records to a user, They cannot digest that much information.

If that does not fit your needs, look at firing one query for 50 results. Make an Ajax call to the the remaining records and build the UI from there, in (reasonably sized) chunks.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top