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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T17:38:44+00:00 2026-05-20T17:38:44+00:00

I have been following the ASP.Net Movie Database Tutorial , and it was all

  • 0

I have been following the ASP.Net Movie Database Tutorial, and it was all going well.

I have just changed the model and added an attribute. Call me curious, but I didn’t want to follow the guide of just drop the database – I wanted to see if I can modify.

The correct error came up about a mismatch – which was expected.

I added the ratings column to the database, and everything worked.

Next, I deleted the ratings column as I wanted to follow the tutorial and learn about DropCreateDatabaseIfModelChanges – however, I just get the error Invalid column name 'Ratings'.

In all this time, the ModelHash entry has not changed, and I have no idea how it know there is a difference between now or before.

So – 1) Have I screwed something up?

2) How can I fix?

3) How did it know before that something has changed, but not now when the hash hasn’t changed?

4) Is there any additional advice you can give?

  • 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-20T17:38:44+00:00Added an answer on May 20, 2026 at 5:38 pm

    I think you description must be incorrect because correct behavior will throw the exception despite of manually added Rating column.

    This behavior works as follows:

    1. When database is created new table called EdmMetadata is added.
    2. EdmMetadata contains two columns – Id and ModelHash.
    3. Part of database creation is storing single row with hash of the current model.
    4. If database was not created by the current context the context executes a query to retrieve stored model hash before the first operation is executed. The retrieved has is compared with context’s current hash.
    5. If hash is not the same and database recreation is not allowed by database initializer the exception is thrown.
    6. If hash is the same, required db operation is executed.

    Adding manually Rating column will not change stored hash but hash of the model will be different.

    This behavior can be completely removed by removing IncludeMetadataConvention convention:

        protected override void OnModelCreating(ModelBuilder modelBuilder)
        {
            base.OnModelCreating(modelBuilder);
            modelBuilder.Conventions.Remove(modelBuilder.Conventions
                .OfType<IncludeMetadataConvention>().ToArray());
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am new to WP7 programming and I have been following this tutorial http://weblogs.asp.net/scottgu/archive/2010/03/18/building-a-windows-phone-7-twitter-application-using-silverlight.aspx
What is the purpose of mocking? I have been following some ASP.NET MVC tutorials
I am new to MVC and I have been following Steven Andersons Pro ASP.Net
The rails books and web pages I've been following have all stuck to very
Alright, I have been doing the following (variable names have been changed): FileInputStream fis
I've been spending the past several weeks working on my asp.net mvc site following
Platform: ASP.NET 3.5, ASP.NET Ajax intermixed I'm very green to jQuery, so have been
I have a database running on MS SQL Server 2005 and an ASP.NET 3.5
I have the following scenario (Asp.net 3.5, Windows Server 2008 R2, IIS7): User1 logs
In my asp.net web site I have custom error pages defined as following in

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.