0:038> !clrstack
OS Thread Id: 0x3550 (38)
Child SP IP Call Site
00000000063adc90 000007fef4759986 System.Collections.Generic.Dictionary`2[[System.Int32, mscorlib],[System.__Canon, mscorlib]].FindEntry(Int32)
00000000063adce0 000007ff00edb625 ZtShop.PageComponent.GetCategoryFileName_Dynamic(Int32)
00000000063add60 000007ff00edb244 ZtShop.PageComponent.GetCategoryFileName(Int32, Boolean)
00000000063addd0 000007ff00edb032 ZtShop.Service.CategoryService.CreateMenu(Int32, System.String, System.Collections.Generic.List`1<Int32>)
00000000063adea0 000007ff00edb064 ZtShop.Service.CategoryService.CreateMenu(Int32, System.String, System.Collections.Generic.List`1<Int32>)
00000000063adf70 000007ff00edb064 ZtShop.Service.CategoryService.CreateMenu(Int32, System.String, System.Collections.Generic.List`1<Int32>)
00000000063ae040 000007ff00edad8d ZtShop.WidgetComponent.GetAllCatMenu(System.String)
00000000063ae090 000007ff00eda1ff ZtShop.WidgetComponent.WidgetParse(System.String, System.String)
00000000063ae1e0 000007ff005362bc ZtShop.WidgetParseFilter.publisher_Begin_Render(System.Object, wojilu.Web.Mvc.MvcEventArgs)
--------------------------------------------我的代码如下
/// <summary>
///
/// </summary>
/// <param name="catId"></param>
/// <param name="curSeldId"></param>
/// <param name="cursPId">当前点击分类的所有父分类</param>
/// <returns></returns>
public static string CreateMenu(int catId,string curSeldId,List<int> cursPId)
{
if (curSeldId == "0") curSeldId = "";
StringBuilder sb = new StringBuilder();
List<Category> cats = Categories.FindAll(p => p.PCatId == catId);
if (cats == null || cats.Count == 0) return "";
sb.AppendFormat("<div class=\"{0}\"><ul>", catId!=0&&IsOpen(catId, curSeldId, cursPId) ? "curselt_div" : "");
foreach (var cat in cats)
{
sb.AppendFormat("<li class=\"{3}\"><a href=\"{0}\">{1}</a>{2}</li>"
, PageComponent.Instance.GetCategoryFileName(cat.Id, true)
, cat.Name
, CreateMenu(cat.Id, curSeldId,cursPId)
, IsOpen(cat.Id, curSeldId, cursPId) ? "curselt_li" : "");
}
sb.AppendFormat("</ul></div>");
return sb.ToString();
}
Categories ---如下:
private static List<Category> _Categories;
public static List<Category> Categories
{
get
{
if (_Categories == null)
{
_Categories = Category.find("order by orderid asc").list();
//内存中不记录三要素
foreach (var _cat in _Categories)
{
_cat.Des = "";
_cat.Page_Description = "";
_cat.Page_Keyword = "";
_cat.Page_Title = "";
}
}
return _Categories;
}
set {
_Categories = value;
}
}