How do I correctly update my EF Core context to use secrets.json instead of a hard-coded connection string?

579 Views Asked by At

It's very unclear how to do this.

I have seen examples that say you can use IConfiguration, some that manually load the secrets.json (but if that's the case, why does it insert metadata into the csproj specifically about secret stores?).

Either way, within my EF context class, the only object I have is DbContextOptionsBuilder

protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
        {
            if (!optionsBuilder.IsConfigured)
            {
               optionsBuilder.UseSqlServer(myConnectionStringGoesHere);

Can anyone offer any advice?

0

There are 0 best solutions below