【发布时间】:2014-11-14 10:24:10
【问题描述】:
我正在尝试在超过 10,000 条记录上实现搜索功能。这在使用 PagedList 时会遇到速度问题。
public ActionResult CrmBlogGroupType(int? page, bool? Name, bool? AuthorTitle, bool? Description, string search, int? PageSize, string type)
{
try
{
if (type==null)
{
type = "A";
}
IEnumerable<Usp_getBlogSetPosts_Result> _objBlogSet = _dataLayer.GetBlogSet(type);
//The above _objBlogSet has around 10 thousand records
ViewBag.CurrentPage = page;
ViewBag.Name = Name ==null?false:Name;
ViewBag.AuthorTitle = AuthorTitle == null ? false : AuthorTitle;
ViewBag.Description = Description == null ? false : Description;
ViewBag.Search = search;
ViewBag.type = type;
if (Name == true && AuthorTitle == false && Description == false)
{
_objBlogSet = _objBlogSet.Where(p => p.author_name.ToLower().Contains(search.ToLower())).ToPagedList(page ?? 1, PageSize ?? 10);
}
return View(_objBlogSet);
catch (Exception ex)
{
throw ex;
}
}
【问题讨论】:
标签: asp.net-mvc asp.net-mvc-3 pagedlist