Files
prefab-page-detail/Prefab.Catalog/Data/ICatalogDbContextFactory.cs
2025-10-27 17:39:18 -04:00

23 lines
1.0 KiB
C#

namespace Prefab.Catalog.Data;
/// <summary>
/// Provides factory methods that create catalog module database contexts on demand.
/// </summary>
public interface ICatalogDbContextFactory
{
/// <summary>
/// Creates a new writable catalog database context instance for the current operation.
/// </summary>
/// <param name="cancellationToken">Token used to cancel context creation.</param>
/// <returns>An <see cref="IModuleDb"/> instance that must be disposed by the caller.</returns>
ValueTask<IModuleDb> CreateWritableAsync(CancellationToken cancellationToken = default);
/// <summary>
/// Creates a new read-only catalog database context instance for the current operation.
/// </summary>
/// <param name="cancellationToken">Token used to cancel context creation.</param>
/// <returns>An <see cref="IModuleDbReadOnly"/> instance that must be disposed by the caller.</returns>
ValueTask<IModuleDbReadOnly> CreateReadOnlyAsync(CancellationToken cancellationToken = default);
}