Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ASYNC and Entity Framework

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

like image 212
Gatmando Avatar asked Feb 16 '11 13:02

Gatmando


People also ask

Should I use async with EF core?

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.

Is Linq asynchronous?

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.

Can IQueryable be async?

ToListAsync(IQueryable)Creates a List<T> from an IQueryable by enumerating it asynchronously.

What is the difference between ToList and ToListAsync?

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.


1 Answers

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.

like image 158
divega Avatar answered Nov 09 '22 18:11

divega