using e_suite.Database.Core;
using eSuite.Core.Clock;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Diagnostics;
using Microsoft.EntityFrameworkCore.Migrations;

namespace e_suite.Database.SqlServer;

public class SqlEsuiteDatabaseDbContext : EsuiteDatabaseDbContext
{
    public SqlEsuiteDatabaseDbContext(DbContextOptions<SqlEsuiteDatabaseDbContext> options, IClock clock) : base(options, clock)
    {
    }

    protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
    {
        optionsBuilder.ConfigureWarnings(w => w.Ignore(SqlServerEventId.SavepointsDisabledBecauseOfMARS));
        optionsBuilder.ReplaceService<IMigrationsSqlGenerator, DatabaseNameReplacerSqlGenerator>();
    }
}