aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcvium <clausvium@gmail.com>2023-10-22 22:28:45 +0200
committercvium <clausvium@gmail.com>2023-10-22 22:28:45 +0200
commit1009836a792f5b76829b8ec9b2a6d859d2cde298 (patch)
treefefd5f61a6d7799e5721a51518db62ea474ebbd5
parentdf7032b09e720cf07169514433557edf22922d0c (diff)
add IAsyncDisposable to DisplayPreferencesManager
Properly dispose dbcontext Add IDisposableAnalyzer to Jellyfin.Server.Implementations
-rw-r--r--Jellyfin.Server.Implementations/Jellyfin.Server.Implementations.csproj4
-rw-r--r--Jellyfin.Server.Implementations/Users/DisplayPreferencesManager.cs9
2 files changed, 12 insertions, 1 deletions
diff --git a/Jellyfin.Server.Implementations/Jellyfin.Server.Implementations.csproj b/Jellyfin.Server.Implementations/Jellyfin.Server.Implementations.csproj
index 390ed58b3..fa6adb022 100644
--- a/Jellyfin.Server.Implementations/Jellyfin.Server.Implementations.csproj
+++ b/Jellyfin.Server.Implementations/Jellyfin.Server.Implementations.csproj
@@ -8,6 +8,10 @@
<!-- Code analysers-->
<ItemGroup Condition=" '$(Configuration)' == 'Debug' ">
+ <PackageReference Include="IDisposableAnalyzers">
+ <PrivateAssets>all</PrivateAssets>
+ <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
+ </PackageReference>
<PackageReference Include="Microsoft.CodeAnalysis.BannedApiAnalyzers">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
diff --git a/Jellyfin.Server.Implementations/Users/DisplayPreferencesManager.cs b/Jellyfin.Server.Implementations/Users/DisplayPreferencesManager.cs
index bfae81e4c..edc6aa173 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
/// <summary>
/// Manages the storage and retrieval of display preferences through Entity Framework.
/// </summary>
- 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();
}
+
+ /// <inheritdoc />
+ public async ValueTask DisposeAsync()
+ {
+ await _dbContext.DisposeAsync().ConfigureAwait(false);
+ }
}
}