这在我的行动方法中,我得到例外。
public ViewResult List(string category, int page = 1)
{
ProductsListViewModel model = new ProductsListViewModel {[enter image description here][1]
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(p => p.Category == category).Count()
},
CurrentCategory = category
};
MyProject.DLL中发生了'System.NullReferenceException'类型的异常,但未在用户代码中处理 //这里是跟踪