コード例 #1
0
 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));
     }
 }
コード例 #2
0
 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);
     }
 }