Quantcast
Channel: Entity Framework
Viewing all articles
Browse latest Browse all 10318

Edited Issue: VS Express 2012 CreateDatabaseIfNotExists not creating database [709]

$
0
0
Using sql server compact, and entity framework 4.3 code first.

Global.asax.cs has a:
Database.SetInitializer<DataContext>(new mySeedingClass());

Visual Web Developer 2010 will recreate the database, with appropriate seed data if I delete the .sdf file in windows and have my seeding class inherit from CreateDatabaseIfNotExists or DropCreateDatabaseAlways (have rechecked multiple times with current solution), .

VS 2012 works fine if I set the seeding class to inherit from DropCreateDatabaseAlways, but while set to CreateDatabaseIfNotExists, I get the error:

Exception Details: System.Data.SqlServerCe.SqlCeException: The database file cannot be found. Check the path to the database.

rather than recreating the database (as is reliably done in VWD 2010). When in debug mode, the Seeding Class constructor does not seem to be called at all if the database has been deleted and the class inherits from CreateDatabaseIfNotExists

Viewing all articles
Browse latest Browse all 10318

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>