我在查询数据库时遇到了问题
public class LinkTabProductCategory
{
[Key]
public int Id { get; set; }
public int ProductId { get; set; }
[JsonIgnore]
public Product Product { get; set; }
public int CatalogSubSectionId { get; set; }
public CatalogSubSection CatalogSubSection { get; set; }
}
var result = DataContext.Product
.Include(o => o.Offers)
.ThenInclude(p => p.Prices)
.ThenInclude(t => t.Type)
.Include(p => p.Brand)
.Include(tb=>tb.LinkTabProductCategories)
.Where( p=>p.LinkTabProductCategories **???** == id)
.ToList();
并且您需要过滤,只获取那些与LinkTabProductCategories
字段CatalogSubSectionId
等于给定变量的表记录有连接的对象Id
。
我也将非常感谢有关文档(或类似文档)的提示,Linq
除了,MSDN
分别。
谢谢
使用扩展方法
Any(predicate)
-true
如果序列中至少有一个元素满足条件,则返回predicate
: