I have commented out all calls to Database.SetInitializer<>()
in my EF Code First application. However, even without any explicit calls to create the database, my Asp.net MVC application is still creating a database. I have several reasons why this is an issue:
1) I don't like the fact that EF is creating a new database without me telling it to.
2) It keeps trying to create (or 开发者_JS百科update) the database on my webhost (even though the database already exists), and thus I am getting permission denied exceptions.
Does anyone have any insight why this seems totally out of my control?
In CTP 5 the solution was
Database.SetInitializer<MyContext>(null);
I think this didn't change in EF 4.1. If you comment the call out it defaults to DropCreateDatabaseIfModelChanges
.
精彩评论