appsettings
files
appsettings.json
appsettings.Production.json
appsettings.Test.json
appsettings.Debug.json
all for specific environment but first for common settings.
appsettings.json
file does not contain connection string, since each environment has its own db.
running add-migration mig-1
obviously complains that
Could not find a connection string named 'ConnectionString'.
How can i specify connection string to be taken from appsettings.Test.json
instead of default one (appsettings.json
)
Found answer in docs
add-migration mig-1 -e Test
Note
EF Core 1.x CLI tools supported an argument called environment which could be use to specify the environment when the commands were run against an ASP.NET Core application. This argument is no longer available in 2.0:
-e|--environment <NAME> The environment to use. Defaults to "Development".
With 2.0, you can use the ASPNETCORE_ENVIRONMENT environment variable instead.