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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T18:46:20+00:00 2026-05-30T18:46:20+00:00

I have a Visual Studio solution with two projects: MyApp.MvcUI and MyApp.Domain (class library).

  • 0

I have a Visual Studio solution with two projects: MyApp.MvcUI and MyApp.Domain (class library).

MyApp.MvcUI contains my SQL Server CE 4 database.

MyApp.Domain is supposed to contain the Entity Framework EDMX file, but if I add it there I don’t have the option to use SQL Server CE 4, only 3.5.

http://www.codetunnel.com/content/images/sqlce35only.jpg

If I add the EDMX in the MvcUI project then I am able to choose SQL Server CE 4.

Question

  1. How can I put my Entity Framework content into the MyApp.Domain project and use a SQL Server CE 4 database that lives in the MyApp.MvcUI project?

  2. Once I solved that problem, what will the data source portion of my connection string in App.Config look like? I know the web project’s connection string will simply look like this:

    Data Source=|DataDirectory|\CE4DB.sdf
    

    but what will that look like in App.Config in the MyApp.Domain project? Will it be an absolute path like

    C:\Code\MyProject\MyApp.MvcUI\App_Data\CE4DB.sdf
    

If so, is there a way to make that a relative path so when people pull the project down from source control it will still work without path corrections?

  • 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-30T18:46:21+00:00Added an answer on May 30, 2026 at 6:46 pm

    I tried the suggestions here. My EF was already at the latest version (4.3 as of this post) but I did install SQL Server CE through nuget as well as EntityFramework.SqlServerCompact which says “Allows SQL Server Compact 4.0 to be used with Entity Framework.” Still no option to use CE 4 in the wizard when trying to update the EDMX model from database. If this is all done in the MVC project then I do have the option to use CE 4 in the dialogue box pictured in my question.

    I did get it to work though. I simply used a connection string like the one it generates when I put the EDMX in the MVC project.

    <add name="EntityContainer" 
         connectionString="metadata=res://*/Model1.csdl|
                                    res://*/Model1.ssdl|
                                    res://*/Model1.msl;
                           provider=System.Data.SqlServerCe.4.0;
           provider connection string=&quot;
             Data Source=..\MyApp.MvcUI\App_Data\CE4DB.sdf&quot;"
         providerName="System.Data.EntityClient" />
    

    I was then able to get the EF designer to read from the database. As a bonus the data source path is relative 😀 so other developers pulling down a fresh copy of the project from source control will also be able to use the EF designer straight away without tweaking it. I’m planning to switch to code-first EF soon but I wanted to get this all working with the EDMX first since that’s what I know how to do currently.

    Obviously at runtime the connection string in MyApp.Domain does not matter because it reads from the active project’s config file. In this case Web.Config for the MvcUI project. In which the connection string is even easier since the path is simplified.

    <add name="EntityContainer"
         connectionString="metadata=res://*/Model1.csdl|
                                    res://*/Model1.ssdl|
                                    res://*/Model1.msl;
                           provider=System.Data.SqlServerCe.4.0;
           provider connection string=&quot;
             Data Source=|DataDirectory|\CE4DB.sdf&quot;"
           providerName="System.Data.EntityClient" />
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Visual Studio solution with two projects : A class library MyLib
I created an empty Visual Studio solution and added two projects: Backend(Class Library type)
I have two class projects in a Visual Studio solution. Due to the nature
I have a Visual Studio 2008 solution with two projects (a Word-Template project and
I have two projects in one Visual Studio 2008 solution. I'd like to use
I have two independent projects in my Visual Studio 2008 solution. Both has its
I have two Visual Studio database projects. Both build fine on my local dev
I have two projects in my Visual Studio solution: The one is a WcfService
So I have a solution (in Visual Studio, 2010) with two projects: ProjectA and
I have a Visual Studio 2010 solution that contains 3 projects: a dll project,

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.