I have a database called ApplicationName_Development running on SQL Server 2008 R2 Developer edition on my development box.
I added .NET membership tables to the databas
Here's another possibility.
If you look at the MvcMusicStore
sample - there's a SampleData
class that is responsible for seeding the database on a rebuild. The SampleData
class inherits from DropCreateDatabaseIfModelChanges
, and overrides the Seed
method. This class is passed to the Database.SetInitializer
in the Application_Start
method in global.asax
.
I was getting the same error as you until I changed the parent class of SampleData
to CreateDatabaseIfNotExist
.
Then you can override the Seed
method to insert any data you desire at startup, without it blowing away the database.