views:

203

answers:

0

I have a partition-like database schema in my database. There's one 'partitioning' table named SITE and every other table has a foreign key to that table (SITE_FK).

I wrote a partial class for an ObjectContext adding a SITE_ID property and a constructor that sets this property.

Now, after I instantiate an ObjectContext with some SITE_ID I need that every single query built with this ObjectContext tests that SITE_FK = SITE_ID (which is stored in ObjectContext). It would be best not to have to test for it explicitly in every query in the code but to test for it somehow 'internally' in the ObjectQuery.

The first thought is to add some functionality to ObjectQuery.Execute method that adds one more Where to the Query but I can't find how to do this.

Any ideas?