1

My understanding is that

await myContext.SaveChangesAsync();

will save the changes, but not allow the thread to continue in the same manner that

myContext.SaveChanges();

behaves.

Is there any difference between these two?

user7560542
  • 527
  • 1
  • 5
  • 14
  • [If async-await doesn't create any additional threads, then how does it make applications responsive?](http://stackoverflow.com/q/37419572) – Alexander Staroselsky Feb 14 '17 at 18:49
  • 5
    Possible duplicate of [If async-await doesn't create any additional threads, then how does it make applications responsive?](http://stackoverflow.com/questions/37419572/if-async-await-doesnt-create-any-additional-threads-then-how-does-it-make-appl) – orvi Feb 14 '17 at 18:54

1 Answers1

3

allow the thread to continue

This is your misunderstanding.

Put simply, synchronous methods like SaveChanges block the calling thread until the method completes.

Asynchronous methods like SaveChangesAsync (when consumed with await) will not block the calling thread. The await will "pause" the method, but it will not block the thread.

You can find more information about how this works in my async intro blog post and my post on There Is No Thread.

Stephen Cleary
  • 437,863
  • 77
  • 675
  • 810