public static async Task ExecuteScopeAsync(Func <IServiceProvider, Task> action) { using (IServiceScope scope = s_scopeFactory.CreateScope()) { AnthemGoldPwaDbContext dbContext = scope.ServiceProvider.GetService <AnthemGoldPwaDbContext>(); try { await dbContext.BeginTransactionAsync().ConfigureAwait(false); await action(scope.ServiceProvider).ConfigureAwait(false); await dbContext.CommitTransactionAsync().ConfigureAwait(false); } catch (Exception) { dbContext.RollbackTransaction(); throw; } } }
public GetApplicationHandler(AnthemGoldPwaDbContext aAnthemGoldPwaDbContext, IConfigurationProvider aConfigurationProvider) { AnthemGoldPwaDbContext = aAnthemGoldPwaDbContext; ConfigurationProvider = aConfigurationProvider; }