Click here to Skip to main content
Rate this:
 
Please Sign up or sign in to vote.
See more: LINQ
Hi All,

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


Thank you
Posted 12-Feb-13 2:23am
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

Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

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.
  Permalink  
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)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Web04 | 2.8.160204.4 | Advertise | Privacy
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100