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

  • Home
  • SEARCH
  • 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 6834931
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T23:10:19+00:00 2026-05-26T23:10:19+00:00

I use EF Code First in my solution with SQL Server Express behind it.

  • 0

I use EF Code First in my solution with SQL Server Express behind it. When I update my model, I always have to delete my database before restarting my solution. I know this is because my database is no more up to date. In that case, I lose all data in my tables.

I would like to be able to update my models (for example: adding a new field) and keeping all data in my tables.

Even if I update manually my database, when I restart the solution, I get the error below:

The model backing the ‘EntityFrameworkDbContext’ context has changed since the database was created. Either manually delete/update the database, or call Database.SetInitializer with an IDatabaseInitializer instance

Any suggestions?

Thanks.

  • 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-26T23:10:20+00:00Added an answer on May 26, 2026 at 11:10 pm

    You can remove the creation of EdmMetadata table as follows.

    public class MyContext : DbContext
    {
    
        protected override void OnModelCreating(DbModelBuilder modelBuilder)
        {
            modelBuilder.Conventions.Remove<IncludeMetadataConvention>();
        }
    }
    

    This way you can manually update the database without getting the error.

    You can check out Code First Migrations

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

Sidebar

Related Questions

I have just transferred my EF 4.0 Solution to use EF 4.1 Code-First. Everything
Normally I create web application projects and use code-behind, but I have a requirement
A little context first: I would say I have good SQL server experience, but
I use this code to determine checkbox width and height: var chk = $('input[type=checkbox]:first');
First the requirements: By management requirements, I can't use open source code. I need
I'm using a MS SQL Server db and use plenty of views (for use
I am using a ASP .NET ListView with a MS SQL Database. I use
I try to create database from entity framework code first follow with this tutorial
I'm using EF CTP5 code-first with Sql CE 4.0. I am trying to perform
We develop a set of industrial applications that use SQL Server. As demand expands,

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.