Linq中的多表左联,详细语句

 from m in context.WX_MemberCollectDish

                              join d in context.Dish on m.DishID equals d.DishID into temp

                              from gc in temp.DefaultIfEmpty()

                              join a in context.AttachMent on new { ParentID = m.DishID } equals new { a.ParentID } into temp2

                              from gc1 in temp2.DefaultIfEmpty()

                              where gc.StoreID == Convert.ToInt32(storeID) && m.MemberID == memberID

                              select new

                              {

                                  UID = gc.UID,

                                  DishID = gc.DishID,

                                  Name = gc.Name,

                                  Price1 = gc.Price1,

                                  FilePath = gc1.WX_FilePath,

                                  WebDishTypeID = gc.WebDishTypeID

                              };


不多解释了,自己看吧!

你可能感兴趣的:(LINQ)