Page 1 of 1

Getting synchronous behavior from ToListAsync

Posted: Thu 30 Jul 2015 15:06
by jeffeynon
Hi,

I have code in my application that uses DevArt dotConnect (version 8.4.457) to connect to an oracle 12c database. I have code that looks like this:

using (var context = new MyContext(myConnectionString)
{
var data = (some lync query).ToListAsync();
var data2 = (some lync query).ToListAsync();

etc etc....

await Task.WhenAll(new Task[] {data, data2....});
}

I have 6 somewhat long running queries (~2 seconds each) that I'm trying to execute in parallel. However this does not appear to be happening. When I run in the debugger and step through the ToListAsync, there is a noticeable pause after each ToListAsync() line like the query is actually running (I can't confirm because I don't have access to trace on the DB and these queries apparently don't show up in intellisense like others do). I would expect the first query to take a second or so to build the EF model, but the other ToListAsync() calls should return immediately. Plus, if I put a breakpoint at the await line, the tasks are ALWAYS completed. Further, according to documentation I read while researching this, the above code shouldn't even work when there are multiple async calls within a dbcontext scope because dbconext isn't threadsafe, so that further suggests that there really isn't anything async happening here.

Please confirm that ToListAsync (and other async methods) truely execute asynchronously, and if so, please advise on what is wrong here.

Re: Getting synchronous behavior from ToListAsync

Posted: Fri 31 Jul 2015 07:43
by MariiaI
jeffeynon wrote:Please confirm that ToListAsync (and other async methods) truely execute asynchronously, and if so, please advise on what is wrong here.
Currently, standard async methods for .NET 4.5 are not supported in dotConnect for Oracle. Due to this fact, the default implementation is used, i.e. such methods are performed synchronously. This functionality is on our roadmap; however, we can't tell any timeframe at the moment. We will inform you when any results are available.

Also, you can vote for "Add compatibility to run ASYNC Queries" suggestion here:
http://devart.uservoice.com/forums/8026 ... nc-queries

Re: Getting synchronous behavior from ToListAsync

Posted: Wed 27 Jul 2022 04:40
by soko
Hello,

7 years (!!) later and this is still not fixed? Am I right? Any news on this?

Soko

Re: Getting synchronous behavior from ToListAsync

Posted: Tue 04 Oct 2022 13:55
by Shalex
There is no technical possibility to support async methods in the OCI Mode (via Oracle Client). The asynchronous implementation in the Direct Mode is on our roadmap but without a timeframe at the moment. We will notify you about the progress.