Linq关系表包括 [英] Linq relational table include
本文介绍了Linq关系表包括的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有4个关系表;
- 类别
- 产品
- ProductBrand
- ProductImage
我需要linq
查询包括ProductBrand from CategoryId
分组.
I need linq
query included 3 tables group by ProductBrand from CategoryId
.
我尝试这个;
var PBrand = from b in db.ProductBrands
join p in db.Products on b.BrandId equals p.BrandId
join i in db.ProductImages on p.ProductId equals i.ProductId
where b.CategoryId == 5
select b;
,但Products
和ProductImages
为空.如何在Brand
表上包含Products
和ProductImages
表?
but Products
and ProductImages
are null. How I include Products
and ProductImages
table on Brand
table?
推荐答案
使用
或扩展方法 这篇关于Linq关系表包括的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!Include
.
查看全文