Entity Framework Code First DB Drop/Recreate on Model Change

Discussion in 'Databases' started by NealHelman, Dec 26, 2011.

Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.
  1. My site at DASP is still in development, and the Entity Framework model is very likely to change. The DropCreateDatabaseIfModelChanges directive is still being used in the global.asax because the site is still in development, and I'm using Code First. I'm wondering what will happen if my code drops the database and attempts to recreate it on the DASP server. Is it as simple as that? I guess my question really is, what happens when my code issues a drop database command? Does it still have access to the server to issue the commands required to rebuild the database?

    Thanks,
    Neal
     
  2. If you were to drop it, you wouldn't be able to re-attach it yourself. You would actually have to contact support and they'd be able to re-attach it for you.

    You are able to bring it back online yourself, should you put it offline by mistake, but unfortunately re-attaching is not a permission we can provide to our customers, as it requires permissions we can't give you in a shared hosting environment.
     
  3. Thanks, Jose. This is what I needed to know. So, for anyone else who finds this thread, know that it is imperative to be able to make the Entity Framework updates in the development environment. This means the project cannot point to the DASP database when changing the Code First modelling. This is a pretty important thing to know up front.
     
Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.

Share This Page