diff options
| author | JPVenson <6794763+JPVenson@users.noreply.github.com> | 2024-10-09 15:20:42 +0000 |
|---|---|---|
| committer | JPVenson <6794763+JPVenson@users.noreply.github.com> | 2024-10-09 15:20:42 +0000 |
| commit | 01d834f21abcb65d246b18762b79001929fe845b (patch) | |
| tree | bc9f61cdb7805a9968f46ab2d7aa9e28bfe2200e /Jellyfin.Server.Implementations/JellyfinDbContext.cs | |
| parent | c2844bda3b7605257d7b2f8d146077cea6dd0b08 (diff) | |
Fixed (most) tests
Diffstat (limited to 'Jellyfin.Server.Implementations/JellyfinDbContext.cs')
| -rw-r--r-- | Jellyfin.Server.Implementations/JellyfinDbContext.cs | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/Jellyfin.Server.Implementations/JellyfinDbContext.cs b/Jellyfin.Server.Implementations/JellyfinDbContext.cs index c1d6d58cd..a9eda1b64 100644 --- a/Jellyfin.Server.Implementations/JellyfinDbContext.cs +++ b/Jellyfin.Server.Implementations/JellyfinDbContext.cs @@ -4,21 +4,19 @@ using Jellyfin.Data.Entities; using Jellyfin.Data.Entities.Security; using Jellyfin.Data.Interfaces; using Microsoft.EntityFrameworkCore; +using Microsoft.Extensions.Logging; namespace Jellyfin.Server.Implementations; /// <inheritdoc/> -public class JellyfinDbContext : DbContext +/// <summary> +/// Initializes a new instance of the <see cref="JellyfinDbContext"/> class. +/// </summary> +/// <param name="options">The database context options.</param> +/// <param name="logger">Logger.</param> +public class JellyfinDbContext(DbContextOptions<JellyfinDbContext> options, ILogger<JellyfinDbContext> logger) : DbContext(options) { /// <summary> - /// Initializes a new instance of the <see cref="JellyfinDbContext"/> class. - /// </summary> - /// <param name="options">The database context options.</param> - public JellyfinDbContext(DbContextOptions<JellyfinDbContext> options) : base(options) - { - } - - /// <summary> /// Gets the <see cref="DbSet{TEntity}"/> containing the access schedules. /// </summary> public DbSet<AccessSchedule> AccessSchedules => Set<AccessSchedule>(); @@ -228,7 +226,15 @@ public class JellyfinDbContext : DbContext saveEntity.OnSavingChanges(); } - return base.SaveChanges(); + try + { + return base.SaveChanges(); + } + catch (Exception e) + { + logger.LogError(e, "Error trying to save changes."); + throw; + } } /// <inheritdoc /> |
