我需要獲得封面圖片的產品。但是當我加pic => pic.IsCover
這是拋出異常。否則沒有問題。我如何解決它?流利的Api包括哪裏條款
錯誤:
The Include path expression must refer to a navigation property defined on the type. Use dotted paths for reference navigation properties and the Select operator for collection navigation properties. Parametre adı: path
感謝所有
_db.ProdSmartSorts
.Where(x => catIds.Contains((int)x.Product.CategoryId))
.OrderBy(x => x.ProdSmartId)
.Select(x => x.Product)
.Include(p => p.Pictures.Where(pic => pic.IsCover))
.Skip(prodCount * (pageNumber - 1))
.Take(prodCount)
.ToList();
嘗試使用SelectMany而不是Select –