maartenba/MvcSiteMapProvider — pull request #140 by NightOwl888 (2013-03-29 21:17:05+00:00)
Title: V4 - Fixes for ReflectionSiteMapBuilder, Reverted DI Implementation in MvcMusicStore

The problem with ReflectionSiteMapBuilder was due to the fact the ChildNodes() collection is Read-Only. Nodes must be added by calling AddNode on ISiteMap or the overload that supports adding a parent node, not ISiteMapNode.ChildNodes.Add(). This was primarily done to ensure that everything gets added to the 4 internal dictionaries of ISiteMap. My thought was that if the nodes were not added directly to ISiteMap, the Find() methods would not necessarily find them. In general, when building the tree it is safer to work with ISiteMap than ISiteMapNode.

Anyway, I did some minor testing to make sure it was functional, I added the CacheResolvedUrl, CanonicalUrl, CanonicalKey, and MetaRobotsValues fields to MvcSiteMapNodeAttribute, and added a check to ensure the node applies to the current SiteMapCacheKey (similar to the SiteMapProviderName in the v3 implementation).

I also reverted the DI implementation, with the one adjustment I discussed previously to make adding additional DI container packages easier. Since the extension method was so closely related to the IDependencyInjectionContainer, I just put it into the same file.