geckos
geckos

Reputation: 6289

Does Npgsql support async?

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 });
}

Upvotes: 2

Views: 2228

Answers (1)

Shay Rojansky
Shay Rojansky

Reputation: 16692

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

Upvotes: 4

Related Questions