public ViewResult List(string category,int page = 1)
{
ProductsListViewModel viewModel = new ProductsListViewModel
{
Products = repository.Products
.Where(p => category == null || p.Category == category)
.OrderBy(p => p.ProductID)
.Skip((page - 1) * PageSize)
.Take(PageSize),
PagingInfo = new PagingInfo
{
CurrentPage = page,
ItemsPerPage = PageSize,
TotalItems = category == null?repository.Products.Count():repository.Products.Where(e => e.Category == category).Count()
},
CurrentCategory = category
};
return View(viewModel);
}
它抛出一个异常说“找不到 SportsStore.Domain.Concrete.ORM.Product 的概念模型类型。” 我想这与我手动添加的 SportStore.edmx 文件有关,但本书只是提到了这个文件,就好像它已经存在一样,实际上不是。所以我必须自己创建ORM,然后抛出异常。我不知道如何检查这个问题,thx..