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 7160951
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T13:28:59+00:00 2026-05-28T13:28:59+00:00

I have a database that was created with the Entity Framework’s code first approach.

  • 0

I have a database that was created with the Entity Framework’s code first approach.

Currently it has just 5 tables. One of the tables, called Incidents, backs the Incident C# class. The class needs to get just one additional property – bool HasClaim.

I know that since the DB is initialized with DropCreateDatabaseWhenModelChanges, the moment I will try to initialize with an adjusted entity class, my DB data will get purged, and a new database will be created.

What is the simplest path for me to make this class/schema update? (in general, like: read data into an XML, recreate DB and manually, from C# code, place new entities.)

P.S.
Maybe I can go ahead and create a Database model from current DB, adjust it, adjust the code, and reconfig to no longer use code-first? I seems like code-first currently is only good if you are 100% sure you are not to change the models after the DB goes into production. But with a successful projects, it is never the case!

  • 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-28T13:29:00+00:00Added an answer on May 28, 2026 at 1:29 pm

    Have a look at Entity Framework Migrations:
    http://blogs.msdn.com/b/adonet/archive/2012/01/12/ef-4-3-beta-1-automatic-migrations-walkthrough.aspx

    Another approach is to only have the DropCreateDatabaseWhenModelChanges strategy in debug builds (for test environments) and then scripting schema changes with another tool for upgrading production environments.

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

Sidebar

Related Questions

Using the Entity Framework 4. I have created a Code First database in the
I have a few tables that are created by entity framework that house my
I am attempting to use Entity Framework and have a contact database that has
I successfully created my first Entity Framework Code first project using SQL Server CE.
Now that I have built a database. Visual Studio 2008 SP1’s ADO.NET Entity Framework
I'm using Entity Framework 4 and I have created a UnitOfWork class that creates
Using the Entity Framework Code First paradigm I have defined the following objects and
I have created a repository that is returning data from my database using Entity
I have created a table in the database that has a System.Guid as it's
I am accessing my database via Entity Framework 4. I have a server that

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.