I'm building a .NET Aspire-based application using PostgreSQL with Entity Framework Core. I’m registering my DbContext like this as I am using Aspire.Npgsql.EntityFrameworkCore.PostgreSQL package:
builder.AddNpgsqlDbContext<AppDbContext>(
"ConnectionName",
configureDbContextOptions: b =>
{
// remove this after testing
b.EnableSensitiveDataLogging(true);
});
I want to customize the name and schema of the EF Core migrations history table (which defaults to __EFMigrationsHistory). I know that if I was using EF Core methods directly to register the DbContext you can do something like:
services.AddDbContext<AppDbContext>(
options =>
{
options
.UseNpgsql(
"ConnectionString",
x => x.MigrationsHistoryTable("__ef_migrations_history"));
});
I am not seeing such an option if I am doing things the Aspire way. Has anyone successfully configured a custom migrations history table name with AddNpgsqlDbContext<>() in a .NET Aspire project? Am I missing something in the setup?
b.UseNpgsql(x => { x.MigrationsHistoryTable("my-table-name"); });alongside theEnableSensitiveDataLoggingline?AddNpgsqlDbContext<AppDbContext>code is already calling UseNpgsql under the hood. I wanted to avoid the redundancy.