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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T01:45:26+00:00 2026-06-12T01:45:26+00:00

I am trying to create a simple EF code first sample using SQL server

  • 0

I am trying to create a simple EF code first sample using SQL server compact edition 4.0.
Technologies used include: Visual Studio 2012 Ultimate.

So i created a simple poco class:

namespace MvcApplication2.Models
{
    public class Customer
    {
        public int CustomerId { get; set; }
        public string CustomerName { get; set; }
    }
}

And a simple context class:

namespace MvcApplication2.Models
{
    public class CustomerEntity : DbContext
    {
        public DbSet<Customer> Customers { get; set; }
    }
}

Then I tried to create a controller class with the template: MVC Controller with read/write actions and views using entity framework.

  • Model class -> Customer
  • Data context class -> CustomerEntity

I got the following error:

Unable to retreive metadata for … Using the same dbcompiledmodel to
create contexts against different types of database servers is not
supported. …

I should say this exact same code worked without problem using LocalDB.

The only difference that I thought was needed, was the addition of the following to the web.config file.

<add name="CustomerEntity"
     connectionString="Data Source=|DataDirectory|CustomerEntity.sdf"
     providerName="System.Data.SqlServerCe.4.0" />

Am I missing something else?

I know I can’t be the only one having this problem.

  • 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-06-12T01:45:28+00:00Added an answer on June 12, 2026 at 1:45 am

    Your problem in dublicate DB in EF cache and DB in your App_Data. The easiest way to resolve this problem is to comment your default constructor CustomerEntity, to create controller from template and then uncomment it.

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

Sidebar

Related Questions

I trying to create a pipe using C#. The code is quite simple but
Im trying to create a simple pan and zoom app using silverlight 4, but
I am trying to create a simple program using Gstreamer to take the input
I'm using C# with TSQL and SQL Server 2005 I'm trying to use PetaPoco
I'm trying to create a simple form that will validate that the first password
I am trying to create a simple blog that has code inclosed in <pre>
i'm trying to develop my first simple app for iphone using the MapKit. I'm
I am trying to create my first web application using ASP.NET. I've created new
I'm trying to create simple script that subscribes a user to a company calendar.
I'm studying webrat and cucumber and trying to create simple example. Here is my

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.