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?
Create a proxy for your context
and then use that in place of the dbc context in your existing queries.