Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can we do cross join in EF?

So basically I asked this question while back:

The query contains references to items defined on a different data context

But this time I am doing it in EF. Does EF supports cross joining between two tables?

like image 806
RG-3 Avatar asked Oct 18 '25 13:10

RG-3


1 Answers

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
                };
like image 164
Aducci Avatar answered Oct 22 '25 07:10

Aducci



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!