MvcSiteMap: Dynamic node provider not reached

不羁岁月 提交于 2019-11-29 14:50:17
Mightymuke

Can you define it in the controller method attributes (and not use XML at all)?

For example:

[MvcSiteMapNode(Title="Details", 
  DynamicNodeProvider = "Project.StoreDetailsDynamicNodeProvider, Project")]
public ActionResult Index()
{
    return View();
}
  1. Seems that the dynamicNodeProvider attribute is ignored in the root node, also when it's defined in attributes.
    So the only way to add a dynamic node provider under the root, is either by specifying it on a dummy action etc. or using XML.
  2. An interesting note: the actual difference between defining in XML and attributes is that if it's defined in attributes, it (i.e. the gen. menu items) will be last in the menu, whereas when defined in XML it will be right after the root item (I guess that would be Home), Note that this is still controllable via the Order property in the attributes.
  3. In my Web.Config, I left the siteMapFile empty, relying in what it said in the wiki page, that the default value is ~/Web.sitemap, in fact this is false (I've already corrected that in the updated wiki).
    I don't think this behavior should be like this, I do think the MvcSiteMap engine should scan for dynamic node providers just as it scans for dynamic node attributes (here is the issue I posted on site).
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!