日期:2014-05-20  浏览次数:20895 次

linq用lambda表达式 left join 自连接怎么写?
linq用lambda表达式 left join 自连接怎么写?

比如树结构。

------解决方案--------------------
不懂学习下
------解决方案--------------------
顶一下
------解决方案--------------------


参考
参考


SQL code
  var leftjoin =  from p  in ctx.Products

                       join c in ctx.Categories

                       on p.CategoryID equals c.CategoryID

                       into pro

                       from x in pro.DefaultIfEmpty()

                       select p.ProductName;

------解决方案--------------------
var ss = DB.Table1s.Join(DB.Table2s, a => a.id, b => b.id, (a, b) => new {a,b} ).DefaultIfEmpty();