Asynchronous Programming
Explore the concepts of synchronous and asynchronous programming in ASP.NET Core, focusing on updating repository interfaces and implementations. Understand how to use async, await, and Task to improve web application efficiency by handling multiple user requests without blocking threads, and learn to adapt both SQL and mock repositories to support asynchronous operations.
Synchronous vs asynchronous
To understand asynchronous programming, you have to understand the difference between synchronous and asynchronous.
Synchronous
When starting to learn to code, the code that is written is almost always synchronous. The operations performed in your code are taking place one after another. For example, there are three tasks: Task A, B, and C. Task B will not start before Task A finishes, and Task C will not start before Task B finishes, even if all three tasks are not dependent on each other.
Asynchronous
An asynchronous operation allows tasks to be executed and completed out of order. If you have three tasks, and none of them are dependent on the other, then they can all execute simultaneously, and one task may complete before the other.
Asynchronous in ASP.NET
Multiple users access a web application at the same time. If you have a server ...