-1
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 take the total 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 kind of manipulation with the query, I get the following exception:
"The specified LINQ Expression contains Ferences to queries that are Associated with Different contexts"
in SO I found the following answer (https://stackoverflow.com/questions/7332920/error-the-specified-linq-expression-contains-references-to-queries-that-are-as) that fits my case:
If they’re 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 table and view to a single EDMX.
my question is: what other solutions do I have for this problem? I am required to create a view?
I don’t recommend in cases of large data mass, but as long as you bring the result of the two queries to memory, the contexts become irrelevant.
– Gabriel Coletta
The problem is exactly this, the mass of data has to be taken into account.
– M. Bertolazo