//-----------------------------------------------------------------------
//
// Copyright (c) aliasvault. All rights reserved.
// Licensed under the AGPLv3 license. See LICENSE.md file in the project root for full license information.
//
//-----------------------------------------------------------------------
namespace AliasServerDb;
using Microsoft.EntityFrameworkCore;
///
/// The AliasServerDbContextFactory interface. This factory was primarily created to support the migration window
/// from SQLite to PostgreSQL (where both were supported). Currently only PostgreSQL is supported, so this factory
/// simply creates an instance of the now default AliasServerDbContext. This factory pattern has therefore became
/// optional and does not actually has any benefits vs. just creating the DbContext directly. But we kept it for
/// now as all clients already use this factory pattern.
///
public interface IAliasServerDbContextFactory
{
///
/// Creates a new AliasServerDbContext.
///
/// The AliasServerDbContext.
AliasServerDbContext CreateDbContext();
///
/// Configures the DbContext options.
///
/// The DbContextOptionsBuilder.
void ConfigureDbContextOptions(DbContextOptionsBuilder optionsBuilder);
///
/// Creates a new AliasServerDbContext asynchronously.
///
/// The cancellation token.
/// A task that represents the asynchronous operation. The task result contains the AliasServerDbContext.
Task CreateDbContextAsync(CancellationToken cancellationToken = default);
}