1
votes

From this question it seems that Npgsql doesn't support async so I start to replace all my calls by synchronous ones, but the answer is very old and I would like to know if it still applies AsyncQuery with postgresql and dapper using npqsql

This is how most of my code looks like

using Dapper;

using(var connection = new NpgsqlConnection(connectionString))
{
    var myResult = connection.QueryAsync<MyModel>(
         "SELECT * FROM my_model_table WHERE id = @id"), new { id });
}
1
From the source here it seems it has been fixed in NpgSqlCommand. - Palle Due

1 Answers

3
votes

Yes, recent versions of Npgsql are fully asynchronous. Calling async ADO.NET APIs will properly perform async network operations.