Entity Framework Migrations with Multiple Web Config Transforms
asp.net-mvc-4, entity-framework, entity-framework-5
Solution
In order to try and keep things as simple as possible, the way I worked around running migrations on my remote staging and production servers, is to run the following command from the package console (data source and user/pass would change depending on which server I wanted to run the migrations against):
Update-Database -Verbose -ConnectionString "Data Source=ServerName;Initial Catalog=db;User Id=user;Password=pass;" -ConnectionProviderName "System.Data.SqlClient"
This has worked for me so far in case anyone else is looking. Thanks everyone for the comments.
Problem
I have created an ASP.NET MVC 4 project in Visual Studio 2010 using Entity Framework 5 with migrations enabled. I have multiple web config files for different environments (Debug, Staging, Release) which will specify different database connectionStrings depending on the environment. How do I handle migrations using the `Update-Database` command from the Package Manager Console with the multiple config files? Each time I run this command, it defaults to the main Web.config connection string. Thanks for any help in advance.