various appsettings multiple environments' json files
My database scripts are created using the Package Manager Console (Add-Migration, Update-Database)
When I execute PM>"Get-DbContext," it retrieves data from my appsettings. GREAT, that's what I want most of the time using the development.json file!
But how do I instruct it to get database variables from appsettings? Instead of development, should PM commands use staging.json?
I've tried making fresh launchSettings.json profiles and setting "ASPNETCORE ENVIRONMENT" to "Staging," but no one appears to take it into consideration except PM.
I can get around that by using Script-Migration to produce scripts, but I like the quick ups and downs I receive and won't utilise that method to deploy to production.
The ASPNETCORE ENVIRONMENT may be manually updated by performing this command in the Package Manager Console, albeit it is not extensively documented.
then you can use the following command to make sure it is referring to the database you want:
This will remove
providerName databaseName dataSource options ------------ ------------ ---------- ------- Microsoft.EntityFrameworkCore.SqlServer myDatabase tcp:fake.database.windows.net,1433 None
then just execute your instructions as usual. Example:
Commands mentioned: https://docs.microsoft.com/en-us/ef/core/miscellaneous/cli/powershell