var prod_Langs = from p_l in db.Prod_Langs
join p in db.Prods on p_l.ProdID equals p.ProdID
join p_ua in db.Prod_UsageAreas on p_l.ProdID equals p_ua.ProdID
where (catId == null || catId < 1 || p.CatID == catId)
&& (brandId == null || brandId < 1 || p.BrandID == brandId)
&& (usageAreaId == null || usageAreaId < 1 || p_ua.UsageAreaID == usageAreaId)
&& p_l.LangID == langId
select p_l;
yerine
var prod_Langs = from p_l in db.Prod_Langs
join p in db.Prods on p_l.ProdID equals p.ProdID
join p_ua in db.Prod_UsageAreas on p.ProdID equals p_ua.ProdID
into data from x in data.DefaultIfEmpty()
where (catId == null || catId < 1 || p.CatID == catId)
&& (brandId == null || brandId < 1 || p.BrandID == brandId)
&& (usageAreaId == null || usageAreaId < 1 || x.UsageAreaID == usageAreaId)
&& p_l.LangID == langId
select p_l;
linq join'i inner join olarak sql'e çeviriyor. left outer join için
into data from x in data.DefaultIfEmpty()
kısmını ekledik.
http://www.oguzyagmur.com/PermaLink,guid,b9fcc750-0e3b-43e4-a9e8-212ee94afa4e.aspx
linq to sql - left outer join with
Gönderen
pantepember
3 Aralık 2009 Perşembe
Etiketler: left outer join , linq to sql