我们可以交叉加入EF吗?
问题描述:
所以基本上我回来问这个问题:
So basically I asked this question while back:
但这一次我在EF做这件事。 EF是否支持两个表之间的交叉连接?
But this time I am doing it in EF. Does EF supports cross joining between two tables?
答
你不能在不同的数据上下文之间进行连接。你将不得不使用linq对象进行连接
You can't do joins between different data context's. You would have to do the join with linq-objects
var crossJoin = from a in context.TableA.AsEnumerable()
from b in context2.TableB.AsEnumerable()
select new
{
a,
b
};