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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T11:43:26+00:00 2026-06-01T11:43:26+00:00

I have two separate sets of tables in the same database that model the

  • 0

I have two separate sets of tables in the same database that model the exact same data but in different states. One is a live state, and the other is a staging state (not test). I am trying to create a model that will allow me to choose which datasource/datacontext to use at runtime, but they must both have the same model.

public TestObject GetTestObject(string testNum, string Environment)
{
    IDataContext context = DataContextFactory.GetContext(Environment);
    TestObject t = (from test in context.Orderable
                         where test.TestNumber == testNum
                         select test).FirstOrDefault();
    return t;
}

Obviously, based on the code above, if the Environment is Staging, I pull from a set of tables. If the Environment is Live, then I pull from a different set of tables.

So, normally with EF, I will get two separate models with different names. If I try give them the same name I get errors stating that there is already an object with that name in the project.

I have recently looked into my own POCO to consume the database, but have not been able to connect the dots to create a solution.

EDIT: Changed from “Two datasources” to “Two sets of tables in the same database”. This was obviously confusing, my apologies.

  • 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-01T11:43:27+00:00Added an answer on June 1, 2026 at 11:43 am

    Is it possible? Probably. Is it a good idea? No. Will it take more time than it’s worth to make it work? Most likely.

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

Sidebar

Related Questions

I have two separate applications (both part of the same system) that share a
Working with one of our partners, we have developed now two separate sets of
I have two sets of items, one that I have my jQuery treating the
I have two separate result sets I want to combine in a one final
I have two sets of data with the same level of grainularity, for example
I have two separate caches running in a JVM (one controlled by a third
I have two divs and two separate links that triggers slideDown and slideUp for
We have two databases, in two separate locations. One of the databases resides in
I have some JavaScript that is sharing a request between two separate servers on
We have two separate web-apps, say 'retailUI' and 'bulkUI'. These two are basically two

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.