
Problem So, if you have been doing development with Visual Studio 2010, Entity Framework CodeFirst, SqlServer or SqlServerCE for any amount of time, you’ll quickly run into the problem that the database can not be reinitialized because it is open. Basically, the scenario is this. 1) Put in your Global.asax.cs file a line that always recreates the database (naturally because you are in a development mode and as you constantly change your model and seed data). The line is something like this: Database.SetInitializer(new DropCreateDatabaseAlways<SiteDB>()); 2) Run your application with something like Debug/Run (All is fine) 3) Go into the database browser (either in Visual Studio or Enterprise … Continue Reading

