maartenba / MvcSiteMapProvider

An ASP.NET MVC SiteMapProvider implementation for the ASP.NET MVC framework.
Microsoft Public License
538 stars 218 forks source link

Adding And Save Nodes Content Management for mvcSiteMap #438

Open ElTamero opened 8 years ago

ElTamero commented 8 years ago

Good day:

I'm planning later to make content managment for the website so i can edit and save the nodes in the aspnetMvcSiteMap . is that possible or is there a phase planned for that ??

I mean Rather than only adding in the code before the release . I want to make tree page to edit adding or deleting links in the file itself

Thanks

NightOwl888 commented 8 years ago

The simplest way is to use a dynamic node provider or implement ISiteMapNodeProvider. See this question for more info.

To update the SiteMap with the latest copy of the data, you just need to add the MvcSiteMapProvider.Web.Mvc.Filters.SiteMapCacheReleaseAttribute to any POST action methods that update any data that will change the node configuration.

NOTE: This of course means that you should use the attribute sparingly and only in cases where the actual data is updated that changes nodes. The whole SiteMap is reloaded with this attribute, so this only works when there are a low proportion of SiteMap updates to a high proportion of SiteMap reads.

You could make something to update the XML if you wish, but it is simpler just not to use XML for configuration at all if you want your nodes to be configurable.