vendredi 29 avril 2016

Code First SQL Express DB from Database First model for Unit testing

I have a database first data model, which I would like use to create an empty code first database to fill it with test data for unit testing purposes. How do I do that? When I'm trying to create a database, I get an 'UnintentionalCodeFirstException'.

My connection string looks like this:

 <add name="MyDBEntities" 
 connectionString="metadata=http://res*/DataModel.csdl|res*/DataModel.ssdl|res*/DataModel.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=(localdb)\v11.0;initial catalog=MyDB;integrated security=True;MultipleActiveResultSets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" />

Aucun commentaire:

Enregistrer un commentaire