C# Linq: Can you merge DataContexts?
Posted
by Andreas Grech
on Stack Overflow
See other posts from Stack Overflow
or by Andreas Grech
Published on 2009-06-11T13:12:33Z
Indexed on
2010/03/27
5:43 UTC
Read the original article
Hit count: 219
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 DataContext
s that contain only the tables that are specific to the client.
Is there a way to kind of "merge" DataContext
s 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 DataContext
s) ?
[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...
© Stack Overflow or respective owner