linq左连接使用equal两边为nullable和非nullable的情况

var query = from p in db.ParentTable
            join t in db.ChildTable on new {A = p.child_ID.GetValueOrDefault(0), B = p.OtherID}
            equals new {A = t.ID, B = t.OtherID} into j1
            from c in j1.DefaultIfEmpty()
            select new
            {
                ...
            };

 

posted @ 2014-03-12 23:11  本杰明·喝茶  阅读(111)  评论(0)    收藏  举报