My situation is quite similar to this link or at least my code is similar and I am trying to find a way to apply this same method in .NET Core syntax.
Pass connectio
IMO best practice:
add to your configuration.json:
"ConnectionStrings": { "BooksContext": "Server=MyServer;Database=MyDb;Trusted_Connection=True;" }
and to initialize section:
services.AddDbContext(options => options.UseSqlServer(configuration.GetConnectionString(nameof(BooksContext))));