mirror of
https://github.com/jellyfin/jellyfin
synced 2024-10-02 22:14:47 +00:00
add IAsyncDisposable to DisplayPreferencesManager
Properly dispose dbcontext Add IDisposableAnalyzer to Jellyfin.Server.Implementations
This commit is contained in:
parent
df7032b09e
commit
1009836a79
|
@ -8,6 +8,10 @@
|
||||||
|
|
||||||
<!-- Code analysers-->
|
<!-- Code analysers-->
|
||||||
<ItemGroup Condition=" '$(Configuration)' == 'Debug' ">
|
<ItemGroup Condition=" '$(Configuration)' == 'Debug' ">
|
||||||
|
<PackageReference Include="IDisposableAnalyzers">
|
||||||
|
<PrivateAssets>all</PrivateAssets>
|
||||||
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
|
||||||
|
</PackageReference>
|
||||||
<PackageReference Include="Microsoft.CodeAnalysis.BannedApiAnalyzers">
|
<PackageReference Include="Microsoft.CodeAnalysis.BannedApiAnalyzers">
|
||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
using Jellyfin.Data.Entities;
|
using Jellyfin.Data.Entities;
|
||||||
using MediaBrowser.Controller;
|
using MediaBrowser.Controller;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
@ -13,7 +14,7 @@ namespace Jellyfin.Server.Implementations.Users
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Manages the storage and retrieval of display preferences through Entity Framework.
|
/// Manages the storage and retrieval of display preferences through Entity Framework.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class DisplayPreferencesManager : IDisplayPreferencesManager
|
public sealed class DisplayPreferencesManager : IDisplayPreferencesManager, IAsyncDisposable
|
||||||
{
|
{
|
||||||
private readonly JellyfinDbContext _dbContext;
|
private readonly JellyfinDbContext _dbContext;
|
||||||
|
|
||||||
|
@ -97,5 +98,11 @@ namespace Jellyfin.Server.Implementations.Users
|
||||||
{
|
{
|
||||||
_dbContext.SaveChanges();
|
_dbContext.SaveChanges();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public async ValueTask DisposeAsync()
|
||||||
|
{
|
||||||
|
await _dbContext.DisposeAsync().ConfigureAwait(false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue