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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T08:55:38+00:00 2026-05-30T08:55:38+00:00

Hello Entity Frameworks Gurus!! I’ve been following the official tutorial and have started a

  • 0

Hello Entity Frameworks Gurus!!

I’ve been following the official tutorial and have started a small project with it. I’ve started using SQL Server Compact Edition and have decided to change it to a SQL Server Express database.

After changing my connectionstring

 <add name="SchoolContext" connectionString="Data  Source=|DataDirectory|Registration.sdf" providerName="System.Data.SqlServerCe.4.0"/>
 <!--    <add name="SchoolContext" connectionString="Data  Source=.\SQLEXPRESS;Integrated Security=True;Initial  Catalog=SchoolRegistration;MultipleActiveResultSets=True"  providerName="System.Data.SqlClient"/>-->

it started throwing this error:

Model compatibility cannot be checked because the database does not contain model metadata. Ensure that IncludeMetadataConvention
has been added to the DbModelBuilder conventions.

What I don’t comprehend is that I have an Initializer which implements the DropCreateDatabaseIfModelChanges

 public class SchoolInitializer : DropCreateDatabaseIfModelChanges<SchoolContext>

and added the Initializer to the Global.asax.cs application_start()

 Database.SetInitializer<SchoolContext>(new SchoolInitializer());

So after my error I deleted the SQL Server Compact .sdf file and switched back to its connection string and all the changes and all fixtures where put in it.

Why not SQL Server Express?

Something I am missing? Or should I have created another context for the new connection string and refactor my Initializer? Thanks for reading this

  • 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-30T08:55:39+00:00Added an answer on May 30, 2026 at 8:55 am

    EF checks whether the model and the database are in sync by checking the values in the EdmMetadata table. In your case that table is missing in the database. But you are using the DropCreateDatabaseIfModelChanges initializer. Hence EF can not determine whether the model has been changed to execute the initializer.

    If you want to use that initializer you need to let EF create the database with the EdmMetadata table (meaning dropping your express database so that EF can recreate it for you from your connectionString). Otherwise remove the initializer and manually do the changes to the database or use EF migrations.

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

Sidebar

Related Questions

I have a simple console app using SQL Compact 4.0 and entity frameworks 4.
Hello i am using ORMLite 4.33. I have an entity class that gives me
Hello I have the following code to retrieve data from my db using nhibernate
Hello I have the following error by git-fsck, which cannot be cleaned by git-gc
Hello we have an SQL server application running over a low bandwith connection. We
Hello i have an Entity Exam @Id @GeneratedValue(strategy=GenerationType.TABLE) private Long id; ..... ...... @ManyToMany
I am getting started with Entity Framework using POCO in a model-first configuration. I
hello, can you help me how to write Linq query (using Entity Framework) for
Hello: I have an app where in a thread hierarchy (persisted entity) is modelled
Hello again ladies and gents! OK, following on from my other question on ASP.NET

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.