Program.cs
Note: i've more a gist about it.
using Microsoft.EntityFrameworkCore;
builder.Services.AddDbContext<Context>(options =>
options.UseNpgsql(System.Environment.GetEnvironmentVariable("POSTGRESQL_STRING") ?? throw new InvalidOperationException("Connection string 'POSTGRESQL_STRING' not found."),
options => options.EnableRetryOnFailure().SetPostgresVersion(new Version(9, 6))
));