diff options
| author | Cody Robibero <cody@robibe.ro> | 2025-03-25 21:34:26 -0600 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-03-25 21:34:26 -0600 |
| commit | d848faeb75f0109b5616f1f8405fa85cf734f860 (patch) | |
| tree | 59671ffe495d438cbb9ce095f1c3f26247095291 /src/Jellyfin.Database/Jellyfin.Database.Implementations/IJellyfinDatabaseProvider.cs | |
| parent | 035ecbdde33ce5b71cd580ebb0c3e1df320f80c7 (diff) | |
| parent | 1b388d729682435b92cb10eba67a1170ecbfcc6c (diff) | |
Merge pull request #13589 from JPVenson/feature/DatabaseRefactor
[Feature] Database code refactor
Diffstat (limited to 'src/Jellyfin.Database/Jellyfin.Database.Implementations/IJellyfinDatabaseProvider.cs')
| -rw-r--r-- | src/Jellyfin.Database/Jellyfin.Database.Implementations/IJellyfinDatabaseProvider.cs | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/src/Jellyfin.Database/Jellyfin.Database.Implementations/IJellyfinDatabaseProvider.cs b/src/Jellyfin.Database/Jellyfin.Database.Implementations/IJellyfinDatabaseProvider.cs new file mode 100644 index 000000000..074016553 --- /dev/null +++ b/src/Jellyfin.Database/Jellyfin.Database.Implementations/IJellyfinDatabaseProvider.cs @@ -0,0 +1,48 @@ +using System.Threading; +using System.Threading.Tasks; +using Microsoft.EntityFrameworkCore; + +namespace Jellyfin.Database.Implementations; + +/// <summary> +/// Defines the type and extension points for multi database support. +/// </summary> +public interface IJellyfinDatabaseProvider +{ + /// <summary> + /// Gets or Sets the Database Factory when initialisaition is done. + /// </summary> + IDbContextFactory<JellyfinDbContext>? DbContextFactory { get; set; } + + /// <summary> + /// Initialises jellyfins EFCore database access. + /// </summary> + /// <param name="options">The EFCore database options.</param> + void Initialise(DbContextOptionsBuilder options); + + /// <summary> + /// Will be invoked when EFCore wants to build its model. + /// </summary> + /// <param name="modelBuilder">The ModelBuilder from EFCore.</param> + void OnModelCreating(ModelBuilder modelBuilder); + + /// <summary> + /// Will be invoked when EFCore wants to configure its model. + /// </summary> + /// <param name="configurationBuilder">The ModelConfigurationBuilder from EFCore.</param> + void ConfigureConventions(ModelConfigurationBuilder configurationBuilder); + + /// <summary> + /// If supported this should run any periodic maintaince tasks. + /// </summary> + /// <param name="cancellationToken">The token to abort the operation.</param> + /// <returns>A <see cref="Task"/> representing the asynchronous operation.</returns> + Task RunScheduledOptimisation(CancellationToken cancellationToken); + + /// <summary> + /// If supported this should perform any actions that are required on stopping the jellyfin server. + /// </summary> + /// <param name="cancellationToken">The token that will be used to abort the operation.</param> + /// <returns>A <see cref="Task"/> representing the asynchronous operation.</returns> + Task RunShutdownTask(CancellationToken cancellationToken); +} |
