Disable DB Creation

Apr 27, 2012 at 3:59 PM

I would like to disable the DB creation, I know to use "Database.SetInitializer(null)" but I don't know how use in this source...

Thank You

Coordinator
Apr 27, 2012 at 6:07 PM

Open the DataContextInitializer file and change inheritance from DropCreateDatabaseAlways to CreateDatabaseIfNotExists or DropCreateDatabaseIfModelChanges.

May 2, 2012 at 7:56 AM

both make me "CREATE DATABASE permission denied in database 'master'." error

Coordinator
May 2, 2012 at 8:37 AM

If you are using CreateDatabaseIfNotExists then you need to create the database on your deployment server.

If you are using DropCreateDatabaseIfModelChanges, then be sure when you are changing the model to change it on deployment server too.

 

This is not directly related to CodeFirst Membership Provider, maybe you should ask questions on Entity Framework Forums