Hi all,
Can anybody help me with next: how can I use two different data contexts in one LINQ request?
using (var db = new DataMapDataContext(Connection))
{
using (var dbAdd = new DataMapDataContext(ConnectionAdd))
{
return (from i in dbAdd.ITEMs
join p in db.U_OTT_PINs on i.ITEMNO equals p.PIN_CODE
where p.PIN_TYPE == Utils.PinItem
select ...
}
}
Is it possible?
UPDATE:
I resolved my issue, but not with different data contexts:
var listPinnedItems = new List<string>();
using (var db = new DataMapDataContext(Connection))
{
listPinnedItems = (from lpi in db.U_OTT_PINs
where lpi.PIN_TYPE == Utils.PinItem
select lpi.PIN_CODE).ToList();
}
using (var dbAdd = new DataMapDataContext(ConnectionAdd))
{
return (from i in dbAdd.ITEMs
where listPinnedItems.Contains(i.ITEMNO)
...