public async Task <T> UsingConnection <T, TOpts>(DbOptions <TOpts> options, Func <MySqlConnection, Task <T> > func) { options.ThrowIfNullArgument(nameof(options)); using (var connection = await CreateConnectionAsync(options.GetConnectionString())) { return(await func(connection)); } }
public async Task UsingConnection <T>(DbOptions <T> options, Func <MySqlConnection, Task> action) { options.ThrowIfNullArgument(nameof(options)); using (var connection = await CreateConnectionAsync(options.GetConnectionString())) { await action(connection); } }