views:

18

answers:

1

Suppose I have two tables:

Tab1(id, shareid, ....)
Tab2(id, shareid, ...)

DB was modeled by EF. Then I want to a linq get same result as following sql:

select t1.* from Tab1 t1 join Tab2 t2 on t1.shareid=t2.shareID

So linq should be somthing like:

ObjectContext.Tab1s.Where(...);

How to write the linq for this request?

A: 

I guess it will be something that looks like this:

var Result = (from t1 in TBL1
               join t2 in TBL2 on t1.SharedId equals t2.SharedId
               where t1.whatever == t2.whatever
               select new{bla,bla,bla,bla} );
Rbacarin
With this kind of linq, how to add Include("Tab3") for eager loading?
KentZhou