Reputation: 1
I have two context classes connected to two different databases, so I am trying to do a join between these entities, but when i wrote:
RackJoinList rjlist = new RackJoinList();
var racks = from rack in tms.TMSRacks
.Where(a=>a.Technology.Tag.ToUpper().StartsWith(q.ToUpper()) || (q ==null))
select rack;
rjlist.Racks = racks.ToList();
var resources = from resource in entities.Resources join c in rjlist.Racks.AsQueryable()
on resource.RESOURCEID ==
I am unable to join resource and the rjlist.Rack, can anyone advise?
Upvotes: 0
Views: 165
Reputation: 10398
As the error indicates, you can't join across two database instances. You could add a linked table in one database and then join it. Alternatively, if you know that the number of records on one side of your query are relatively low (under 2000) you could get the ID's from the first table and then use the .Contains method to generate an IN clause rather than using a join. Otherwise you are stuck loading all of your records from both tables into memory and then joining them using LINQ to Objects (which will likely be a performance bottleneck).
Upvotes: 1