aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcrobibero <cody@robibe.ro>2020-07-21 10:19:53 -0600
committercrobibero <cody@robibe.ro>2020-07-21 10:19:53 -0600
commit9787b2fe8a3004788e6d1b58217f74c41ecec826 (patch)
tree97eccd13815a1ed2f8e69c317066b7ccd8da9023
parent0750357916b600a4b4c27bc4babd2adcc6390473 (diff)
Detach tracked entries on dispose
-rw-r--r--Jellyfin.Server.Implementations/JellyfinDb.cs13
1 files changed, 13 insertions, 0 deletions
diff --git a/Jellyfin.Server.Implementations/JellyfinDb.cs b/Jellyfin.Server.Implementations/JellyfinDb.cs
index 53120a763..acc6eec1c 100644
--- a/Jellyfin.Server.Implementations/JellyfinDb.cs
+++ b/Jellyfin.Server.Implementations/JellyfinDb.cs
@@ -1,5 +1,6 @@
#pragma warning disable CS1591
+using System;
using System.Linq;
using Jellyfin.Data;
using Jellyfin.Data.Entities;
@@ -133,6 +134,18 @@ namespace Jellyfin.Server.Implementations
return base.SaveChanges();
}
+ /// <inheritdoc/>
+ public override void Dispose()
+ {
+ foreach (var entry in ChangeTracker.Entries())
+ {
+ entry.State = EntityState.Detached;
+ }
+
+ GC.SuppressFinalize(this);
+ base.Dispose();
+ }
+
/// <inheritdoc />
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{