Fixed DbContext usage on Provider

This commit is contained in:
JPVenson
2025-01-27 16:35:46 +00:00
parent aa811eb1e3
commit 9d1c4ea169
10 changed files with 35 additions and 18 deletions

View File

@@ -575,7 +575,11 @@ namespace Emby.Server.Implementations
/// <returns>A task representing the service initialization operation.</returns>
public async Task InitializeServices()
{
var jellyfinDb = await Resolve<IDbContextFactory<JellyfinDbContext>>().CreateDbContextAsync().ConfigureAwait(false);
var factory = Resolve<IDbContextFactory<JellyfinDbContext>>();
var provider = Resolve<IJellyfinDatabaseProvider>();
provider.DbContextFactory = factory;
var jellyfinDb = await factory.CreateDbContextAsync().ConfigureAwait(false);
await using (jellyfinDb.ConfigureAwait(false))
{
if ((await jellyfinDb.Database.GetPendingMigrationsAsync().ConfigureAwait(false)).Any())