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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T21:11:54+00:00 2026-05-10T21:11:54+00:00

Can I use two different back ends for an .net Entity Framework project? I

  • 0

Can I use two different back ends for an .net Entity Framework project?

I need to support the full programmability support of stored procedures on SQL server when available. I need to support only table structures in a .mdb file when SQL server is not available.

All business logic above the Entity Framework uses the entity abstratctions rather than going directly to the database. The entity model can use either stored procedure calls or dynamic sql to read/write to the database tables.

Is it possible to create two logically identical entity models, each with different mappings to the database (one managed by the framework, one managed by stored procedures), and switch between them at runtime based on the functionality provided by the back-end storage mechanism?

  • 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. 2026-05-10T21:11:54+00:00Added an answer on May 10, 2026 at 9:11 pm

    You should see this similar SO question. I am not sure if you can do this at runtime, but I’ve found this to be possible after deployment. Beware, there are definitely pitfalls.

    The main differences between EDMX files that are generated between different database backends are the MSL and the SSDL. What I’ve done is generated the EDMX file separately from each database. They both have the same logical data model (CSDL). I then extract the MSL and SSDL file and save it into separate files. Once that is done, you can specify in your connection string the exact location of these files (as shown):

    <add name='DBConnection' connectionString='metadata=C:\sqlServerEntities.csdl|C:\sqlServerEntities.ssdl|C:\sqlServerEntities.msl;provider=System.Data.SqlClient;provider connection string=&quot;Data Source=[machinename];Initial Catalog=[databasename];Persist Security Info=True;User ID=[user];Password=[password];MultipleActiveResultSets=True&quot;' providerName='System.Data.EntityClient' />  <add name='DBConnection' connectionString='metadata=C:\mdbEntities.csdl|C:\mdbEntities.ssdl|C:\mdbEntities.msl;provider=[mdb provider namespace];provider connection string=[DB connection string]' providerName='System.Data.EntityClient' /> 

    You’d have to use the appropriate connection string at runtime based on which database you’re connecting to. I am concerned that you might have difficulty using stored procedures in one scenario and table-based mapping in the other though.

    One other note: you cannot leave both the EDMX models in your project or you will create compiler errors (based on duplicate class definitions). However, you have to leave one in your project so the compiler knows about the logical classes that were generated.

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

Sidebar

Ask A Question

Stats

  • Questions 63k
  • Answers 63k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • added an answer Reconsidered answer I've been rethinking my original answer below. I… May 11, 2026 at 10:38 am
  • added an answer Try the following. Not an imperative WPF expert so you… May 11, 2026 at 10:38 am
  • added an answer On the storyboard there is a SpeedRatio setting which is… May 11, 2026 at 10:38 am

Related Questions

Can I use two different back ends for an .net Entity Framework project? I
The examples I can find use a two layer architecture, where the controllers directly
Can I use this approach efficiently? using(SqlCommand cmd = new SqlCommand(GetSomething, new SqlConnection(Config.ConnectionString)) {
Can I use JavaScript to check (irrespective of scrollbars) if an HTML element has
Can I use the ClickOnce deployment method to deploy and auto update applications targeted
Can I use comments inside a JSON file? If so, how?
Can I use javascript in a page to cause an event in a silverlight
Can I use a query in MSSQL to get the .mdf and .ldf filename/location
Can I use SQL Authentication with User Instances?
Can I use Update panel in masterpage to wrap nested pages so that when

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.