asp.net - MvcSiteMapProvider store all nodes in database -
now have mvc.sitemap xml file next data:
<mvcsitemapnode title="rts" imageurl="fa fa-share-alt" controller="dashboard" action="index" area="referrals" > <mvcsitemapnode title="dashboard" controller="dashboard" action="index" area="referrals" ></mvcsitemapnode> <mvcsitemapnode title="referrals" controller="list" action="index" area="referrals" visibility="sitemappathhelper,!*"> <mvcsitemapnode title="new referral" controller="list" action="new" area="referrals" visibility="sitemappathhelper,!*" preservedrouteparameters="id" /> <mvcsitemapnode title="details" controller="list" action="details" area="referrals" visibility="sitemappathhelper,!*" preservedrouteparameters="id" > <mvcsitemapnode title="edit" action="edit" area="referrals" visibility="sitemappathhelper,!*" preservedrouteparameters="id"/> </mvcsitemapnode> </mvcsitemapnode> </mvcsitemapnode>
and want store nodes in db, , have 1 not root node, this:
<mvcsitemapnode visibility="menuhelper,!*" title="home" controller="home" action="index" imageurl="fa fa-home"> <mvcsitemapnode visibility="menuhelper,!*" title="home" controller="home" action="index" imageurl="fa fa-home" dynamicnodeprovider="rmp.webclient.infrastructure.sitemapdynamicnodeprovider, rmp.webclient"> </mvcsitemapnode> </mvcsitemapnode>
can using dynamicnodeprovider or best way implement logic?
yes, can utilize single dynamic node provider supply nodes if prefer. need ensure map of key , parent key properties correctly. best bet if using internal di.
if using external di, there improve option. implement isitemapnodeprovider, , wouldn't need xml file (or .net attribute) @ host root node. isitemapnodeprovider implemented in similar way idyanmicnodeprovider, primary difference operates @ lower level , requires external di inject implementation. see this answer sample isitemapnodeprovider implementation , this answer see how might inject implementation. need inject built-in xmlsitemapnodeprovider if intend utilize xml node configuration , reflectionsitemapnodeprovider if intend utilize [mvcsitemapnodeattribute] node configuration.
note in future versions of mvcsitemapprovider, able utilize isitemapnodeprovider without external di container.
asp.net sitemap mvcsitemapprovider
No comments:
Post a Comment