mardi 30 septembre 2014

Where clause in EF


Vote count:

0




we have 4 entity , Bills, BillDetails ,Products, ProductGroups


what i want to do is something like this



var qry = from bill in ctx.Bills
join billDetail in ctx.BillDetails on bill.Id equal billDetail.Bill_Id
join product in ctx.Products on billDetail.Product_Id equals product.Id
join productGroup in ctx.ProductGroups on product.ProductGroup_Id equals productGroup.Id
where
productGroup.Id == 113
select bill;


the problem is if we disable lazy loading the returnded bill dos not contains BillDetail entity, we have to return it explicitly as anonymous object


is there any way to convert it to something like this ?



var qry = ctx.Bills
.Include("BillDetails")
.Include("BillDetails.Products")
.Include("BillDetails.Products.ProductGroup")
.where(s=>s.BillDetails.Products.ProductGroup.Id == 113);


asked 50 secs ago







Where clause in EF

Aucun commentaire:

Enregistrer un commentaire