Skip to content

Commit a398cb3

Browse files
author
Bart Koelman
committed
Enable registered services to dispose asynchronously, where possible
1 parent a1c698b commit a398cb3

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

test/NoEntityFrameworkTests/WorkItemTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ protected override HttpClient CreateClient()
163163

164164
private async Task RunOnDatabaseAsync(Func<AppDbContext, Task> asyncAction)
165165
{
166-
using IServiceScope scope = _factory.Services.CreateScope();
166+
await using AsyncServiceScope scope = _factory.Services.CreateAsyncScope();
167167
var dbContext = scope.ServiceProvider.GetRequiredService<AppDbContext>();
168168

169169
await asyncAction(dbContext);

test/TestBuildingBlocks/IntegrationTestContext.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ public void ConfigureServicesAfterStartup(Action<IServiceCollection> servicesCon
130130

131131
public async Task RunOnDatabaseAsync(Func<TDbContext, Task> asyncAction)
132132
{
133-
using IServiceScope scope = Factory.Services.CreateScope();
133+
await using AsyncServiceScope scope = Factory.Services.CreateAsyncScope();
134134
var dbContext = scope.ServiceProvider.GetRequiredService<TDbContext>();
135135

136136
await asyncAction(dbContext);

0 commit comments

Comments
 (0)