I've just been reading up on the upcoming changes to c# and VB.Net using the new ASYNC and AWAIT keywords for asynchronous coding. Has anyone heard anything about whether or not this is going to be usable for async db calls via EF?
Thanks
The rule of thumb is to use async on any thread that by it's busy type waiting, would hamper other threads. For the use of async will have the operations of waiting to step it aside until the data return.
Note that there are no async versions of some LINQ operators such as Where or OrderBy, because these only build up the LINQ expression tree and don't cause the query to be executed in the database. Only operators which cause query execution have async counterparts.
ToListAsync(IQueryable)Creates a List<T> from an IQueryable by enumerating it asynchronously.
2 answers. ToListAsync() is ToList asynchronous. Asynchronous methods can be executed without crashing the application's main thread. Eg in a WinForms application, do not hang the GUI on long operations.
We are evaluating the possibility of adding async capabilities to EF in the future, using the new Task-based pattern. It is too early to say whether and when this will happen but any information about the scenarios in which you expect to be able to take advantage of this feature will be greatly appreciated.
UPDATE: Async support has been added in EF6.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With