public async Task EnqueueAsync(Message message) { const string sql = "insert into MessageQueue(Type, PublishedOnUTC, Payload) values(@Type, @PublishedOnUTC, @Payload)"; using (IDatasourceConnection conn = await _datasource.GetConnectionAsync()) { await conn.ExecuteNonQueryAsync(sql, new { message.Type, message.PublishedOnUTC, message.Payload }); } }
public async Task <IDatasourceConnection> GetConnectionAsync() { LocalTransaction tx = LocalTransaction.Current; if (tx != null) { return(await tx.BeginOrJoinTransactionAsync(_underlying)); } return(await _underlying.GetConnectionAsync()); }