This question might seem duplicate, but I have done enough reading and still couldn't find answer to my question.
Lets imagine I have some pseudo code like this.
[HttpGet("someendpoint")]
public Task<IActionResult> DoSomethingAsync()
{
await DoSomethingPrivateAsync();
}
private Task DoSomethingPrivateAsync()
{
await ADONETExecuteReaderAsync();
}
What happens when someendpoint
is hit. I understand when await
is encountered, control is returned to the caller. But who runs the code inside DoSomethingPrivateAsync
?
Also, assuming this Web API is hosted on Kestrel or any webserver, what happens when control returns back upon hitting await
?
My above example above is very simple, but I am trying to understand in a broader perspective. For example, if there is long chain of await
's (with some IO operations in between), how does the execution happen?