我的应用程序有以下search
模型MVC
。
public class SearchFilters
{
public SearchFilters()
{
MinPrice = "10000";
MaxPrice = "8000000";
}
public IEnumerable<SelectListItem> Categories { get; set; }
public string[] CategoriesId { get; set; }
public IEnumerable<SelectListItem> Locations { get; set; }
public string[] LocationID { get; set; }
public IEnumerable<SelectListItem> Status { get; set; }
public string[] StatusID { get; set; }
public string MinPrice { get; set; }
public string MaxPrice { get; set; }
}
现在当用户搜索任何记录时,它将通过model
数据传递选定的参数,我的获取请求如下:
[HttpGet]
public ActionResult Search([Bind(Prefix = "searchModel")]SearchFilters smodel)
{
CategoryViewModel model = new CategoryViewModel();
model = _prepareModel.PrepareCategoryModel("Search", smodel);
if (model.projects.Count == 0)
{
return Json(new { message = "Sorry! No result matching your search", count = model.projects.Count }, JsonRequestBehavior.AllowGet);
}
return PartialView("_CategoryView", model);
}
如果传递的参数是 astring
或int
,我可以设置VaryByParam = "param"
,或者如果是多个,则使用';'
分隔值设置。但是我将如何缓存复杂的model
这里缓存复杂的参数?