C#, Dapper, SQL Server and Connection Pooling
Thanks Juharr - I've upvoted your reply.
For reference to others, I changed write function to await and Dapper async:
private async Task WriteMessageToDB(Guid id, string tableName, string jsonString) { string sql = *Redacted* await dbConnection.ExecuteScalarAsync<int>(sql, new { ID = id, Body = jsonString }); }
And then created a new task in the caller that monitors the outcome.
This is working consistently under load, and not seeing excessive new connections being created either.