mardi 18 novembre 2014

Code-First Migrations for multiple databases?


Vote count:

0




I have the following connection string:



<?xml version="1.0" encoding="utf-8"?>
<connectionStrings>
<add name="MyContext" connectionString="metadata=http://res*;provider=System.Data.SqlClient;provider connection string='data source=SQLSERVERDB;initial catalog=TestDB_CodeFirst;user id=***;password=***;MultipleActiveResultSets=True;App=EntityFramework'" providerName="System.Data.EntityClient" />
</connectionStrings>
</configuration>


When I try to enable migrations I first get a warning:



Cannot determine a valid start-up project. Using project 'MyApp.Model' instead.
Your configuration file and working directory may not be set as expected.
Use the -StartUpProjectName parameter to set one explicitly.


Then I get this exception:



Argument 'xmlReader' is not valid. A minimum of one .ssdl artifact
must be supplied.


Is the connection string wrong and why should I need ssdl if I'm using Code First?


NOTE



  • My context is in MyApp.Model project where my Migrations folder should be located.

  • I don't have connection strings in my main startup project because connection strings are retrieved from a second database and the user can select one of them when logging in to the application.

  • I have just one connection string shown above in my MyApp.Model project which points to my development database.


Also, my second question is: If I use CF migrations, will all databases be migrated each time a user selects a different database for the first time?



asked 3 mins ago







Code-First Migrations for multiple databases?

Aucun commentaire:

Enregistrer un commentaire