开发者

How to write linq to join two tables with no relationship?

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?


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} );
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜