Click here to Skip to main content
15,883,799 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi All,

How to use two different context for a single LINQ statement.


Thank you
Posted
Comments
Matej Hlatky 12-Feb-13 8:22am    
You cannot combine two different data contexts, even two different instances of same context.
Why do you need that?
Swathi Nagaraj 13-Feb-13 7:07am    
I am using joins, where the tables are in two different database. I did it by two different Linq statement and it works fine, But performance is too slow.

1 solution

Matej is right. You can't.
But by asking this question I assume your 2 contexts have the same set of objects otherwise you would not even think of running the same linq statement on them... So what you need is most probably to re-use the same context but with a different connection string.
 
Share this answer
 
Comments
Swathi Nagaraj 13-Feb-13 7:10am    
I am using joins where the table are in different context.If I use 2 linq statements one for each context, It works but performance is slow

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900