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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T04:31:50+00:00 2026-05-20T04:31:50+00:00

I’ve implemented a content management system that deals with a certain kind of object,

  • 0

I’ve implemented a content management system that deals with a certain kind of object, and now the client has introduced another kind of object, whose structure and behavior is exactly the same, but separate. They want to be able to switch modes, where each mode behaves identically, except that one deals with one object type and the other with the other.

Suppose the first object type is stored in a table called TBL_OBJECT, and the second in one called TBL_OBJECT_NEW. I’m looking for a way to use my existing code, but to be able to switch on the fly and have it switch to the other table. Because the structure is identical, this is conceptually possible. The only problem is that in L2E, the table name is saved as attribute and compiled in, so I’m looking for a way to hook the sql statement creation process, so that my existing statements like this:

Dim db as New DataContext
Dim query = From obj in db.Objects

will resolve to the TBL_OBJECT_NEW table instead of the TBL_OBJECT table. If I can do this, I can reuse a huge amount of code. I know it’s a somewhat unusual scenario, but I’m really hoping it’s possible. Any help much appreciated! Thanks.

By the way, I’m using LinqConnect from DevArt for this; I don’t know how much a plain L2E approach will apply to this. On the other hand, if you know how to do it with DevArt but NOT L2E, that would still be very helpful.

  • 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-20T04:31:51+00:00Added an answer on May 20, 2026 at 4:31 am

    We are not aware of any possibility of having two identical tables mapped to one conceptual entity.

    Both in LinqConnect and in Entity Framework there is a solution. For example, you can try switching between two models having only one difference (the first model will map TBL_OBJECT, the second – TBK_OBJECT_NEW).

    LinqConnect solution:

    To switch between different tables with the same structure in LinqConnect, you can create two .lqml files and load mapping from one of them for the current DataContext instance:

    string mappingFileName;
    if (...) // Check whether TBL_OBJECT_A should be used
      mappingFileName = "MyDataContext_A.lqml";
    else 
      mappingFileName = "MyDataContext_B.lqml";
    Stream contextStream = System.IO.File.OpenRead(mappingFileName);
    System.Data.Linq.Mapping.MappingSource mappingSource =
    Devart.Data.Linq.Mapping.XmlMappingSource.FromStream(contextStream);
    MyDataContext context = new MyDataContext(connectionString, mappingSource);
    

    Also, we plan to support fluent mapping (the approach when mapping is set in your code without using attributes or mapping files), though cannot provide any timeframe for this at the moment. You can vote for this feature at our UserVoice.

    Entity Framework solution:

    Set the Metadata Artifact Processing property to CopyToOutputDirectory. After this go to the generated SSDL files and change the table name from “TBL_OBJECT” to “TBL_OBJECT_NEW”.
    The only thing now is to create the context with the correct connection string (you can either add a new connection string to the application configuration file or pass the entire connection string to the ObjectContext constructor).

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

Sidebar

Related Questions

I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I want to count how many characters a certain string has in PHP, but
I've got a string that has curly quotes in it. I'd like to replace
I'm working with an upstream system that sometimes sends me text destined for HTML/XML
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
link Im having trouble converting the html entites into html characters, (&# 8217;) i
this is what i have right now Drawing an RSS feed into the php,
I have a small JavaScript validation script that validates inputs based on Regex. I
I am doing a simple coin flipping experiment for class that involves flipping a

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.