Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4092774
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T19:32:03+00:00 2026-05-20T19:32:03+00:00

I am attempting to deploy my first alpha version of a system online for

  • 0

I am attempting to deploy my first alpha version of a system online for a few people to start using. On development I make heavy use of the DropCreateDatabaseOnModelChange<TContext> (I don’t have it in front of me at the moment so I can’t verify the exact name) to re-initialize my dev database every time my model changes. This happens in the Global.asax.

However, I do not want this to happen on my web host where other people are entering real data. I need to handle all db migrations on there myself so data is preserved.

I had considered #ifdef DEBUG tags to prevent the database initializer from being called, but I don’t like that solution. Right now, I have the debug version deployed, so if they come across any errors it is easy for me to see and debug them (this is very very alpha, so only a select few people are using it and know to expect errors).

What other options do I have to prevent Prod DB dropping by EF4 code first?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T19:32:03+00:00Added an answer on May 20, 2026 at 7:32 pm

    You can always create a new Configuration (in addition to Debug and Release). You would then define a Conditional Compilation Symbol for the new configuration. For example if I created a new configuration called LocalDebug (with the same settings at the default debug) I would then add LOCALDEBUG to the Conditional Compilation Symbols. With this defined you can use:

    #if LOCALDEBUG
      //do database stuff
    #endif
    

    Then you can still deploy the built in debug configuration and this section will not fire.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am attempting to deploy my webapp using maven to an embedded tomcat server.
I'm attempting to use the community TFS Build Extensions Azure activities to deploy to
I am attempting to deploy my first app on Heroku and having a little
I am using Capistrano to deploy a ruby on rails project. I am attempting
I am attempting to deploy a RoR app using Passenger onto my DreamHost hosting
I have a Django app we're attempting to deploy to a Tomcat server, using
We use teamcity to deploy several of our projects. I'm attempting to setup the
I'm attempting to use the VS2010 command line utility, devenv.exe, to deploy a web
I am attempting to deploy a Java application from Eclipse (Version: Indigo Release, Build
I'm attempting to deploy ODP.Net with my application using the Oracle Instaclient. While reading

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.