Click here to Skip to main content
13,451,718 members (47,914 online)
Rate this:
Please Sign up or sign in to vote.
See more:
Hi All,

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

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

Advertise | Privacy |
Web01-2016 | 2.8.180318.3 | Last Updated 12 Feb 2013
Copyright © CodeProject, 1999-2018
All Rights Reserved. Terms of Service
Layout: fixed | fluid

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