Support For ExecuteNonQueryAsync, ExecuteReaderAsync, ExecuteScalarAsync

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for SQLite
Post Reply
Famous
Posts: 2
Joined: Sun 19 Apr 2015 19:19

Support For ExecuteNonQueryAsync, ExecuteReaderAsync, ExecuteScalarAsync

Post by Famous » Sun 19 Apr 2015 19:31

Does Dotconnect support these methods? I see they are supported in the 'System.Data.Common.DbCommand' class. The only methods I see in the library are the 'BeginExecuteReader' and 'EndExecuteReader' methods which require a bit of work to get implemented correctly rather than 'await sqCommand.ExecuteScalarAsync()'. If the library does not have those method could we please get them added if possible.

Pinturiccio
Devart Team
Posts: 2420
Joined: Wed 02 Nov 2011 09:44

Re: Support For ExecuteNonQueryAsync, ExecuteReaderAsync, ExecuteScalarAsync

Post by Pinturiccio » Mon 20 Apr 2015 13:50

The ExecuteNonQueryAsync, ExecuteReaderAsync, ExecuteScalarAsync methods were added in the .NET Framework 4.5. dotConnect for SQLite is built with .NET Framework 2.0 and does not have the ExecuteNonQueryAsync, ExecuteReaderAsync, and ExecuteScalarAsync methods.

Currently, SQLiteCommand implements async execution of the ExecuteReader and ExecuteNonQuery methods. For more information, please refer to http://www.devart.com/dotconnect/sqlite ... mbers.html

You can read more on asynchronous query execution in our documentation: http://www.devart.com/dotconnect/sqlite ... onous.html

Please tell us if implementing BeginExecuteScalar and EndExecuteScalar in the same way as BeginExecuteReader and EndExecuteReader would be suitable for you.

Famous
Posts: 2
Joined: Sun 19 Apr 2015 19:19

Re: Support For ExecuteNonQueryAsync, ExecuteReaderAsync, ExecuteScalarAsync

Post by Famous » Mon 20 Apr 2015 14:38

So are you saying SQLiteCommand already supports the ExecuteReaderAsync and ExecuteNonQueryAsync methods meaning, I can just call "await ExecuteNonQueryAsync()" or do I have to implement the BeginExecuteNonQuery and EndExecuteNonQuery methods?

Ideally, what I am looking to be able to do is call "await ExecuteNonQueryAsync()", "await ExecuteReaderAsync()" or "await ExecuteScalarAsync()" ...ect in one line without having to deal with the BEGIN and END methods at all.

Right now I am wrapping my ExecuteScalar and ExecuteNonQuery in a Task.Run method so It runs on a Thread Pool thread and not freeze my Main Thread if I am doing bulk inserts or heavy reads. I am using this library with a Windows Forms application. From my understanding most of the .NET Async methods that deal with IO use IO Completion Ports and not Thread Pool threads. I am hoping Async methods would eliminate my need for running my queries using Thread Pool threads.

Pinturiccio
Devart Team
Posts: 2420
Joined: Wed 02 Nov 2011 09:44

Re: Support For ExecuteNonQueryAsync, ExecuteReaderAsync, ExecuteScalarAsync

Post by Pinturiccio » Tue 21 Apr 2015 14:50

Famous wrote:So are you saying SQLiteCommand already supports the ExecuteReaderAsync and ExecuteNonQueryAsync methods meaning, I can just call "await ExecuteNonQueryAsync()" or do I have to implement the BeginExecuteNonQuery and EndExecuteNonQuery methods?
No, dotConnect for SQLite does not support such methods.
Famous wrote:From my understanding most of the .NET Async methods that deal with IO use IO Completion Ports and not Thread Pool threads. I am hoping Async methods would eliminate my need for running my queries using Thread Pool threads.
We will analyze the possibility of using I/O Completion Ports for asynchronous command execution methods but there is no timeframe.

Post Reply