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

The Archive Base Latest Questions

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

I have a dbml to which I have added more then 15 tables from

  • 0

I have a dbml to which I have added more then 15 tables from an SQL Server 2008 DB. I then have about 50 LINQ to SQL queries, some quite complex, running against one or more of these tables.

And now the spec has changed, as they tend to do, and there is a version column added to all of these tables, and all the queries need to operate on data from a specific version.

so for example

dim q = from a in dbc.T1, b in dbc.T2
        where a.c1=b.c2 And
        a.c2 > param1

needs to become

dim q = from a in dbc.T1, b in dbc.T2
        where a.c1=b.c2 And
        a.c2 > param1 And
        a.version = version_param And 
        b.version = version_param

As I said, the LINQ statements are much more complex, and usually involve several tables in each.

Any clever ideas on how I can implement this without editing each query and inserting an

        a.version = version_param

qualifier for each table involved?

  • 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-01T06:26:46+00:00Added an answer on June 1, 2026 at 6:26 am

    Create a proxy for your context

    class ContextProxy
    {
       MyDbContext _dbc;
       int _t1version = ...;
       ... etc
    
       public ContextProxy(MyDbContext dbc){ _dbc = dbc; }
    
       public IQueryable<T1Type> T1
       {
          get{ return _dbc.T1.Where( t => t.version == _t1version );
       }
    
       ... etc
    }
    

    and then use that in place of the dbc context in your existing queries.

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

Sidebar

Related Questions

I have two tables in a LINQ to SQL dbml file. I am trying
I have a working database application using WPF and SQL Server 2008 R2, which
I have a WPF application with a Linq to SQL model. In the .dbml
I have written a Stored procedure which return some fields from a temporary table
I have been using LINQPad to prototype some queries against a SQL 2000 database,
I'm playing with LINQ-To-SQL in .NET 3.5 and have built some classes based on
I have a class reflecting my dbml file which extends DataContext, but for some
Website using .NET Framework v3.5, SQL Server 2008, written in C# I have a
I have the following DBML modification (i'm using Linq to SQL as a DAL).
I have a dbml file (linq to sql) to connect to my database. I

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.