Skip to content

Instantly share code, notes, and snippets.

Last active Jul 28, 2021
What would you like to do?
static async Task Main(string[] args)
using (var scope = new TransactionScope(TransactionScopeAsyncFlowOption.Enabled))
await Save(product);
// we might update more entities
public static async Task Save(Product product)
using (var connection = new MySqlConnection(“...”))
await connection.OpenAsync();
// select count(1) from Products where Id = @id
if (await Exists(product, connection))
// update Products set ... where Id = @id
await Update(product, connection);
// insert into Products values(...)
await Insert(product, connection);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment