I have the following query:
var query = (from q1 in query1
join q2 in query1 on q1.idGenerico equals q2.idGenerico into q2Left
from q2 in q2Left.DefaultIfEmpty()
join q3 in query3 on q2.idGenerico equals q3.idGenerico into q3Left
from q3 in q3Left.DefaultIfEmpty()
select new { q1, q2, q3});
Basically it is a query to group others, which are of different contexts, from it I have to get the total of records resulting from this grouping, and popular a list of objects that will be returned by the query method. >
My problem is: When trying to do any sort of manipulation with the query, I get the following exception:
"The specified LINQ expression contains references to queries that are associated with different contexts "
In SO I found the following answer ( link ) that fits in my case:
If they are on different databases but on the same instance, create a view on one of the databases that selects from the table on the other database, then add the local EDMX table and view.
My question is: what other solutions do I have for this problem? Am I required to create a view?