#region ========================================================================= USING =====================================================================================
using Lumina.Application.Common.DataAccess.Repositories.Authorization;
using Lumina.Application.Common.DataAccess.Repositories.BookLibrary;
using Lumina.Application.Common.DataAccess.Repositories.MediaContributors;
using Lumina.Application.Common.DataAccess.Repositories.MediaLibrary;
using Lumina.Application.Common.DataAccess.Repositories.MusicLibrary;
using Lumina.Application.Common.DataAccess.Repositories.Playlists;
using Lumina.Application.Common.DataAccess.Repositories.Plugins;
using Lumina.Application.Common.DataAccess.Repositories.Scheduling;
using Lumina.Application.Common.DataAccess.Repositories.Themes;
using Lumina.Application.Common.DataAccess.Repositories.Users;
using Lumina.Domain.Common.Primitives;
using System.Threading;
using System.Threading.Tasks;
#endregion
namespace Lumina.Application.Common.DataAccess.UoW;
///
/// Interaction boundary with the Data Access Layer.
///
public interface IUnitOfWork
{
///
/// Gets the permission repository.
///
IPermissionRepository PermissionRepository { get; }
///
/// Gets the role permission repository.
///
IRolePermissionRepository RolePermissionRepository { get; }
///
/// Gets the role repository.
///
IRoleRepository RoleRepository { get; }
///
/// Gets the role user repository.
///
IUserRoleRepository UserRoleRepository { get; }
///
/// Gets the book repository.
///
IBookRepository BookRepository { get; }
///
/// Gets the artist repository.
///
IArtistRepository ArtistRepository { get; }
///
/// Gets the album repository.
///
IAlbumRepository AlbumRepository { get; }
///
/// Gets the track repository.
///
ITrackRepository TrackRepository { get; }
///
/// Gets the repository for the artwork of the music library items.
///
IMusicArtworkRepository MusicArtworkRepository { get; }
///
/// Gets the repository for the music metadata staged during a media library scan.
///
IMusicLibraryScanItemMetadataRepository MusicLibraryScanItemMetadataRepository { get; }
///
/// Gets the media contributor repository.
///
IMediaContributorRepository MediaContributorRepository { get; }
///
/// Gets the directory scan fingerprint repository.
///
IDirectoryScanFingerprintRepository DirectoryScanFingerprintRepository { get; }
///
/// Gets the library repository.
///
ILibraryRepository LibraryRepository { get; }
///
/// Gets the library scan repository.
///
ILibraryScanRepository LibraryScanRepository { get; }
///
/// Gets the library scan snapshot repository.
///
ILibraryScanSnapshotRepository LibraryScanSnapshotRepository { get; }
///
/// Gets the library scan staging results repository.
///
ILibraryScanStagingResultsRepository LibraryScanStagingResultsRepository { get; }
///
/// Gets the library metadata provider configuration repository.
///
ILibraryMetadataProviderConfigurationRepository LibraryMetadataProviderConfigurationRepository { get; }
///
/// Gets the library artwork provider configuration repository.
///
IArtworkProviderConfigurationRepository ArtworkProviderConfigurationRepository { get; }
///
/// Gets the library book reader configuration repository.
///
ILibraryBookReaderConfigurationRepository LibraryBookReaderConfigurationRepository { get; }
///
/// Gets the scheduled job repository.
///
IScheduledJobRepository ScheduledJobRepository { get; }
///
/// Gets the scheduled job execution repository.
///
IScheduledJobExecutionRepository ScheduledJobExecutionRepository { get; }
///
/// Gets the scheduler display preferences repository.
///
ISchedulerDisplayPreferencesRepository SchedulerDisplayPreferencesRepository { get; }
///
/// Gets the plugin repository.
///
IPluginRepository PluginRepository { get; }
///
/// Gets the theme repository.
///
IThemeRepository ThemeRepository { get; }
///
/// Gets the user repository.
///
IUserRepository UserRepository { get; }
///
/// Gets the user settings repository.
///
IUserSettingsRepository UserSettingsRepository { get; }
///
/// Gets the music play record repository.
///
IMusicPlayRecordRepository MusicPlayRecordRepository { get; }
///
/// Gets the playlist repository.
///
IPlaylistRepository PlaylistRepository { get; }
///
/// Saves the changes made to the database.
///
/// Cancellation token that can be used to stop the execution.
/// An representing either a successful operation, or an error.
Task> SaveChangesAsync(CancellationToken cancellationToken);
///
/// Detaches all the entities tracked by the unit of work, freeing the memory they occupy.
///
void ClearTrackedEntities();
///
/// Begins a new database transaction.
///
/// Cancellation token that can be used to stop the execution.
/// A task representing the asynchronous operation.
Task BeginTransactionAsync(CancellationToken cancellationToken);
///
/// Commits the current transaction.
///
/// Cancellation token that can be used to stop the execution.
/// A task representing the asynchronous operation.
Task CommitTransactionAsync(CancellationToken cancellationToken);
///
/// Rolls back the current transaction.
///
/// Cancellation token that can be used to stop the execution.
/// A task representing the asynchronous operation.
Task RollbackTransactionAsync(CancellationToken cancellationToken);
}