From 1009836a792f5b76829b8ec9b2a6d859d2cde298 Mon Sep 17 00:00:00 2001 From: cvium Date: Sun, 22 Oct 2023 22:28:45 +0200 Subject: [PATCH] add IAsyncDisposable to DisplayPreferencesManager Properly dispose dbcontext Add IDisposableAnalyzer to Jellyfin.Server.Implementations --- .../Jellyfin.Server.Implementations.csproj | 4 ++++ .../Users/DisplayPreferencesManager.cs | 9 ++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/Jellyfin.Server.Implementations/Jellyfin.Server.Implementations.csproj b/Jellyfin.Server.Implementations/Jellyfin.Server.Implementations.csproj index 390ed58b3b..fa6adb0220 100644 --- a/Jellyfin.Server.Implementations/Jellyfin.Server.Implementations.csproj +++ b/Jellyfin.Server.Implementations/Jellyfin.Server.Implementations.csproj @@ -8,6 +8,10 @@ + + all + runtime; build; native; contentfiles; analyzers + all runtime; build; native; contentfiles; analyzers diff --git a/Jellyfin.Server.Implementations/Users/DisplayPreferencesManager.cs b/Jellyfin.Server.Implementations/Users/DisplayPreferencesManager.cs index bfae81e4ca..edc6aa1738 100644 --- a/Jellyfin.Server.Implementations/Users/DisplayPreferencesManager.cs +++ b/Jellyfin.Server.Implementations/Users/DisplayPreferencesManager.cs @@ -4,6 +4,7 @@ using System; using System.Collections.Generic; using System.Linq; +using System.Threading.Tasks; using Jellyfin.Data.Entities; using MediaBrowser.Controller; using Microsoft.EntityFrameworkCore; @@ -13,7 +14,7 @@ namespace Jellyfin.Server.Implementations.Users /// /// Manages the storage and retrieval of display preferences through Entity Framework. /// - public class DisplayPreferencesManager : IDisplayPreferencesManager + public sealed class DisplayPreferencesManager : IDisplayPreferencesManager, IAsyncDisposable { private readonly JellyfinDbContext _dbContext; @@ -97,5 +98,11 @@ namespace Jellyfin.Server.Implementations.Users { _dbContext.SaveChanges(); } + + /// + public async ValueTask DisposeAsync() + { + await _dbContext.DisposeAsync().ConfigureAwait(false); + } } }