Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Asynchronous ADO.NET

I'm trying to write an asynchronous server that queries a SQL Server database and am concerned that my DB side is too synchronous. Specifically, I can call ExecuteReader asynchronously but cannot then call reader.Item asynchronously and is where 57% of the time is spent (blocking my precious thread!).

Is this the most asynchronous I can do with ADO.NET or is there an asynchronous way to do reader.Item as well?

like image 230
J D Avatar asked Oct 03 '11 08:10

J D


People also ask

What is asynchronous in asp net?

An asynchronous request takes the same amount of time to process as a synchronous request. For example, if a request makes a web service call that requires two seconds to complete, the request takes two seconds whether it is performed synchronously or asynchronously.

What is asynchronous method in C#?

C# asynchronous method is a special method that executes asynchronously. C# provides async modifier to make a method asynchronous. It is used to perform asynchronous tasks. C# await expression is used to suspend the execution of a method.

What is asynchronous .NET Core?

Asynchronous programming allows you to write programs that don't block on each statement or instruction, meaning the computer can move on to other tasks before waiting for previous tasks to finish. As a result, asynchronous programming enables you to build applications that are more scalable and responsive.

What is synchronous and asynchronous in .NET Core?

ASP.NET Core apps should be designed to process many requests simultaneously. Asynchronous APIs allow a small pool of threads to handle thousands of concurrent requests by not waiting on blocking calls. Rather than waiting on a long-running synchronous task to complete, the thread can work on another request.


1 Answers

Looks like this issue is to be fixed in the next version of the framework:

DbDataReader.ReadAsync and DbDataReader.NextResultAsync

like image 115
Random Dev Avatar answered Oct 16 '22 09:10

Random Dev