C# Linq: Can you merge DataContexts?
- by Andreas Grech
Say I have one database, and this database has a set of tables that are general to all Clients and some tables that are specific to certain clients.
Now what I have in mind is creating a primary DataContext that includes only the tables that are general to all the clients, and then create separate DataContexts that contain only the tables that are specific to the client.
Is there a way to kind of "merge" DataContexts so that it becomes one context? So for Client A, I need one DataContext that includes both the general tables and also the tables for that specific client (retrieved from two different DataContexts) ?
[Update]
What I think I can do is, from the Partial Class of the DataContext instead of letting my DataContext inherit from DataContext I make it inherit from MyDataContext; that way, the tables from MyDataContext and the other DataContext will be available in one DataContext class.
What do you think about this approach? Of course with something like this you can only merge two datacontexts at once though...