When using Entity Framework Migrations 4.3, how do you name the database explicitly?

ef-migrations entity-framework

Accepted Answer

When doingupdate-database The project that houses the migrants should be mentioned. Make certain you own anapp.config the project's file that has the proper connection string in it.

The connection string used when executing an application that has been divided up over numerous projects is the one from the project that was first launched. The connection string used during migration is that of the project containing the migrations.

The connection string had to be added twice when I performed a configuration identical to that. While a little odd, it works.

33
2/25/2012 1:10:42 PM

Popular Answer

By providing it as a parameter, you may avoid handling it in app.config:

Update-Database -Verbose 
 -ConnectionString "CONNECTIONSTRING" 
 -ConnectionProviderName "System.Data.SqlClient"
 -StartupProjectName WEBSITE_PROJECT -ProjectName MIGRATION_PROJECT

Easy-peasy if you like typing for hours on end.



Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow