Visual Studio C#: Update-Database issue


I got a code-first project hosted online (Website).
When I run [Update-Database] from the console on Visual Studio, it update my local database but if I change my ConnectionString to the online one, it update the Online Database (production)

How can I force Update-Database to use online connection string without changing my CnnString ?

In code I’m currently using a cmd line variable (added in IIS) to distinguish if the program is running local or online in order to allow the program to branch eitheir local or online for some code.

But when I run Update-Database, it use the “current” Db ConnectionString.

I’m mostly using Update-Database local, but I need to do it for online before publishing
I didn’t find the documentation for Update-Database, is there any option to it ?

I found the [Update-Database 0] method, wich is very usefull so I’m thinking there might be more option to [Update-Database].

Leave a Reply

Your email address will not be published. Required fields are marked *