Entity Framework Feature Suggestions

Async/Await supported asynchronous calls

With the looming release of Dot.Net 4.5 and Windows 8 we are really going to been aync calls which return a Task so there is support for the async/await keywords in C# 5.0

Database operations can be notoriously slow making it highly necessary to delegate these tasks to an asynchronous model.

Windows 8 dictates that if any operation in a metro style app takes longer than 50ms it should be async.

await context.SaveChangesAsync()

517 votes
Vote
Sign in
Check!
(thinking…)
Reset
or sign in with
  • facebook
  • google
    Password icon
    I agree to the terms of service
    Signed in as (Sign out)
    You have left! (?) (thinking…)
    oliverrcoliverrc shared this idea  ·   ·  Flag idea as inappropriate…  ·  Admin →
    Mike FlaskoMike Flasko shared a merged idea: Support for asynchronous queries  ·   · 

    15 comments

    Sign in
    Check!
    (thinking…)
    Reset
    or sign in with
    • facebook
    • google
      Password icon
      I agree to the terms of service
      Signed in as (Sign out)
      Submitting...
      • Timur BabyukTimur Babyuk commented  ·   ·  Flag as inappropriate

        Building high loaded server applications without asynchronous DB access possibility breaks any async investments because database manipulations is usually the slowest part in request processing chain. Please consider adding async features (data obtaining and saving) as soon as possible, otherwise EF remains a choice for relatively slow and quiet usage scenarios.

      • Tamas FlamichTamas Flamich commented  ·   ·  Flag as inappropriate

        I think this requires the presence of abstracts async methods in the DbConnection, DbCommand classes (etc. BeginOpen, EndOpen, BeinExecuteReader, EndExecuteReader) too.

      • Boas EnklerBoas Enkler commented  ·   ·  Flag as inappropriate

        This would be really great. I'm currently building an application which works in a EDA style way. the lack of async methods forces me to use threads where an async method would just be the perfect thing

      • Ladislav MrnkaLadislav Mrnka commented  ·   ·  Flag as inappropriate

        It looks like a great idea but reverse is truth. First of all asynchronous execution doesn't belong to ORM. Upper layer (your code) should handle it when needed. You have tools like task parallel library to handle it without problems. Secondly as I know no major complex .NET ORM supports asynchronous operations. It is related to way how ORMs work internally. async support would leave impression that you can execute multiple operations on the same "context" concurrently but you cannot. EF context is not thread safe and making it thread safe would affect performance. It would also require whole new connection handling - resulting in more complex context lifetime management. Concurrent data modifications are not possible at all (unit of work) and concurrent reading has its own limitation in identity map implemented inside ORM.

      • dequidtdequidt commented  ·   ·  Flag as inappropriate

        Please please release an asynchrone EF with all the new async features in the next release of C# (cf. visual studio Async CTP)

      • RR commented  ·   ·  Flag as inappropriate

        If asynchronous queries are considered, please consider using the QueryableObservable from the reactive extensions.

      Feedback and Knowledge Base