blob: 3b654f4c4691b95d937e34dba73bbd2c63cfae4f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
using System;
using System.Threading.Tasks;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Logging;
namespace Jellyfin.Database.Implementations.Locking;
/// <summary>
/// Default lock behavior. Defines no explicit application locking behavior.
/// </summary>
public class NoLockBehavior : IEntityFrameworkCoreLockingBehavior
{
private readonly ILogger<NoLockBehavior> _logger;
/// <summary>
/// Initializes a new instance of the <see cref="NoLockBehavior"/> class.
/// </summary>
/// <param name="logger">The Application logger.</param>
public NoLockBehavior(ILogger<NoLockBehavior> logger)
{
_logger = logger;
}
/// <inheritdoc/>
public void OnSaveChanges(JellyfinDbContext context, Action saveChanges)
{
saveChanges();
}
/// <inheritdoc/>
public void Initialise(DbContextOptionsBuilder optionsBuilder)
{
_logger.LogInformation("The database locking mode has been set to: NoLock.");
}
/// <inheritdoc/>
public async Task OnSaveChangesAsync(JellyfinDbContext context, Func<Task> saveChanges)
{
await saveChanges().ConfigureAwait(false);
}
}
|