Skip to content
This repository was archived by the owner on Jul 30, 2024. It is now read-only.

Commit 7e0ae33

Browse files
author
Christy Henriksson
authored
Fix EntitiesContext creation (#574)
1 parent eb5e6c6 commit 7e0ae33

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

  • src/NuGet.Services.Revalidate

src/NuGet.Services.Revalidate/Job.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
using System;
55
using System.Collections.Generic;
66
using System.ComponentModel.Design;
7-
using System.Data.SqlClient;
7+
using System.Data.Common;
88
using System.IO;
99
using System.Linq;
1010
using System.Threading.Tasks;
@@ -120,9 +120,10 @@ protected override void ConfigureJobServices(IServiceCollection services, IConfi
120120

121121
services.AddScoped<IGalleryContext>(provider =>
122122
{
123-
var config = provider.GetRequiredService<IOptionsSnapshot<GalleryDbConfiguration>>().Value;
123+
var connectionFactory = provider.GetRequiredService<ISqlConnectionFactory<GalleryDbConfiguration>>();
124+
var connection = connectionFactory.CreateAsync().GetAwaiter().GetResult();
124125

125-
return new GalleryContext(config.ConnectionString, readOnly: false);
126+
return new GalleryContext(connection, readOnly: false);
126127
});
127128

128129
// Core

0 commit comments

Comments
 (0)