Skip to content

Releases: maartenba/MvcSiteMapProvider

v4.4.2

25 Sep 13:45
Compare
Choose a tag to compare

Change Log

  1. Bug: Added missing VisibilityProvider, UrlResolver, and Clickable properties to DynamicNode.
  2. Bug: Fix for #234, upgrading changes encoding of web.config file.
  3. Bug: Source code now included in NuGet symbols package.

v4.3.1

25 Sep 13:31
Compare
Choose a tag to compare

Important Manual Update Recommended for DI Modules

If you installed v4.3.0 into a new project AND you installed one of the MvcSiteMapProvider.MVC[x].DI.[ContainerName] packages, you probably did not get the important update that it included. This release fixes the NuGet package logic, but unfortunately the damage has already been done on your project and some manual updating is required.

You can check whether you got the update by looking at the packages.config file in your project. It should include MvcSiteMapProvider.MVC[x].DI.[ContainerName].Modules that is the same version as MvcSiteMapProvider.MVC[x].DI.[ContainerName]. If you didn't get the update, the modules package will likely be 4.0.17, which was out of date at the time you installed MvcSiteMapProvider.

The safest way to fix this is to see the diff in commit 425c15cdfef7ee70b3226845daf2f91c8d3d7f12 and use it as a guide to manually update your DI module. You only need the one for the DI container you are using.

A more brute force way to apply the fix is to use the following package manager console command to update your modules package. This will overwrite any customizations you have done to the DI module or other startup code, so making a backup is highly recommended.

PM> Update-Package MvcSiteMapProvider.MVC[x].DI.[ContainerName].Modules -Version 4.3.1  -IgnoreDependencies -FileConflictAction Overwrite

Change Log

  1. Bug: Fix for #233, web.config format changes when installing.
  2. Bug: Fix for #234, upgrading updates Web.config package.
  3. Bug: Fixes problem with new DI NuGet package installation not installing the most recent version of modules.
  4. Bug: Source code now included in NuGet symbols package.

v4.2.1

25 Sep 13:03
Compare
Choose a tag to compare
  1. Bug: Fix for #233, web.config format changes when installing.
  2. Bug: Fix for #234, upgrading updates Web.config package.
  3. Bug: Fixes problem with new DI NuGet package installation not installing the most recent version of modules.
  4. Bug: Source code not included in NuGet symbols package.

v4.1.2

25 Sep 13:01
Compare
Choose a tag to compare
  1. Bug: Fix for #233, web.config format changes when installing.
  2. Bug: Fix for #234, upgrading updates Web.config package.
  3. Bug: Fixes problem with new DI NuGet package installation not installing the most recent version of modules.
  4. Bug: Source code not included in NuGet symbols package.

v4.4.1

25 Sep 05:04
Compare
Choose a tag to compare

Important Manual Update Recommended for DI Modules

If you installed v4.4.0 into a new project AND you installed one of the MvcSiteMapProvider.MVC[x].DI.[ContainerName] packages, you probably did not get the important update that it included. This release fixes the NuGet package logic, but unfortunately the damage has already been done on your project and some manual updating is required.

You can check whether you got the update by looking at the packages.config file in your project. It should include MvcSiteMapProvider.MVC[x].DI.[ContainerName].Modules that is the same version as MvcSiteMapProvider.MVC[x].DI.[ContainerName]. If you didn't get the update, the modules package will likely be 4.0.17, which was out of date at the time you installed MvcSiteMapProvider.

The safest way to fix this is to see the diff in commit 425c15cdfef7ee70b3226845daf2f91c8d3d7f12 and use it as a guide to manually update your DI module. You only need the one for the DI container you are using.

A more brute force way to apply the fix is to use the following package manager console command to update your modules package. This will overwrite any customizations you have done to the DI module or other startup code, so making a backup is highly recommended.

PM> Update-Package MvcSiteMapProvider.MVC[x].DI.[ContainerName].Modules -Version 4.4.1  -IgnoreDependencies -FileConflictAction Overwrite

Change Log

  1. Bug: Fix for #233, web.config format changes when installing.
  2. Bug: Fix for #234, upgrading updates Web.config package.
  3. Bug: Fix for #222, sitemaps index page links broken when hosted in sub-application.
  4. Bug: Fixes problem with new DI NuGet package installation not installing the most recent version of modules.

v4.4.0

21 Sep 20:18
Compare
Choose a tag to compare

Important Default Behavioral Changes

Default HTTP Method

The HttpMethod property of the SiteMap node is used to determine which Action method to use to determine whether or not the user has access. Previously, the default was set to * (or the current request). This behavior doesn't make sense because the default HTML helper code always creates hyperlinks, which do a GET.

Therefore, the default is now to use GET. That is, the AuthorizeAttribute of the Action method that uses HttpGet will be the one that is used to determine whether the user should has access to the node.

This value can still be overridden by setting the httpMethod property of the SiteMap node. The only reason why you might want to change it is if you alter the HTML helpers in some way that causes them to use POST or another HTTP method, which will likely be edge cases.

Node Property Validation

The following validation is now being done on the SiteMap node, and if validation fails you will receive a detailed exception message. Keep this in mind when upgrading, as you might need to fix your node configuration (although it should be pretty unlikely).

  • Title is required
  • Controller + Action or URL is required
  • HttpMethod must be a valid value (or not set)
  • RouteValues cannot have the same key as PreservedRouteParameters for the same node
  • RouteValues cannot have the same key as InheritedRouteParameters for the same node

Change Log

  1. Bug: Fix for #230, default value of HttpMethod should be GET.
  2. Bug: Deleted UrlResolverException because it is never thrown.
  3. Feature: Changed the URL resolution so it will support the ~/ syntax when setting the Url property.
  4. Bug: Fix for #222, sitemap links broken when hosted in sub-application.
  5. Bug: Deprecated overloads of IXmlSiteMapResultFactory that don't include a page number because using them could cause the /sitemap.xml endpoint to stop working when the site reaches 35,000 nodes.
  6. Feature: Added validation to ensure required node properties are set and that conflicting properties are not used simultaneously.
  7. Bug: Fix for #231, projects using MvcSiteMapNodeAttribute that have a different project name from assembly name get assigned a value for area when areas are not being used.
  8. Enhancement: Deprecated AreaName property and created Area property on MvcSiteMapNodeAttribute to be used instead (for consistency with the rest of the project).

v4.3.0

12 Sep 22:35
Compare
Choose a tag to compare

This is the most significant release since 4.0.0. There are some behavioral changes to be aware of and some manual updating of configuration code is highly recommended (but not required) if you are using an external DI container.

Important Default Behavioral Changes

Orphaned Node Detection

Up until this release, you could declare nodes as MvcSiteMapProviderAttribute or Dynamic Node Providers that specified a ParentKey that doesn't exist and you would neither see the orphaned node in your HTML helpers or get an error.

This has changed. We now use logic that ensures your configuration is valid or it will throw an exception. The exception message contains detailed information about which nodes could not be added to the sitemap as well as where they originated from.

When upgrading, you should take this into consideration, as you might need to spend some time fixing orphaned node problems.

XML Nested Dynamic Node Provider Processing

The default logic of processing nested DynamicNodeProviders in XML has changed. Take the following XML for example:

<mvcSiteMapNode title="VendorDetails" dynamicNodeProvider="MyNamespace.VendorDetailsDynamicNodeProvider, MyAssembly">
    <mvcSiteMapNode title="VendorAPIDetails" dynamicNodeProvider="MyNamespace.VendorAPIsDynamicNodeProvider, MyAssembly">
        <mvcSiteMapNode title="VendorAPITableDetails" dynamicNodeProvider="MyNamespace.VendorAPIVirtualTablesDynamicNodeProvider, MyAssembly"/>
    </mvcSiteMapNode>
</mvcSiteMapNode>

Up until this release, the logic would first call VendorDetailsDynamicNodeProvider. For each node that was returned from that provider, VendorAPIsDynamicNodeProvider would be called one time and then it would be called one final time at the end. In short, it would be called N + 1 times.

In turn, the VendorAPIsDynamicNodeProvider would call the VendorAPIVirtualTablesDynamicNodeProvider N + 1 times. So for example if our VendorDetailsDynamicNodeProvider returned 10 nodes, and our VendorAPIsDynamicNodeProvider returned 10 nodes, VendorAPIsDynamicNodeProvider would be called 11 times, and VendorAPIVirtualTablesDynamicNodeProvider would be called 111 times.

This behavior was clearly broken, and the default logic now calls each DynamicNodeProvider 1 time per declaration in the XML whether they are nested or not.

In other words, the above configuration will produce exactly the same result as this one.

<mvcSiteMapNode title="VendorDetails" dynamicNodeProvider="MyNamespace.VendorDetailsDynamicNodeProvider, MyAssembly"/>
<mvcSiteMapNode title="VendorAPIDetails" dynamicNodeProvider="MyNamespace.VendorAPIsDynamicNodeProvider, MyAssembly"/>
<mvcSiteMapNode title="VendorAPITableDetails" dynamicNodeProvider="MyNamespace.VendorAPIVirtualTablesDynamicNodeProvider, MyAssembly"/>

If for some reason you managed to get an application working with that anomalous behavior and it now requires it, there is a web.config setting MvcSiteMapProvider_EnableSiteMapFileNestedDynamicNodeRecursion that can be used to re-enable it. If you are using an external DI configuration, this setting can be found on the constructor of the XmlSiteMapNodeProvider and is named useNestedDynamicNodeRecursion.

We don't recommend using this setting unless you absolutely require it, and even then we highly recommend you either move your recursion logic inside of a DynamicNodeProvider or you change your application so it doesn't require recursion at all (it could probably perform much better than it does). This configuration setting will likely disappear in a future major release.

Important External DI Configuration Update

There is a major design change in this release to fix node processing order problems, but to avoid breaking backward compatibility some existing features were deprecated instead of removed. That means you don't have to do this, but we highly recommend you do or you won't be taking advantage of the latest bug fixes or future updates to the code.

Please see the diff in commit 425c15cdfef7ee70b3226845daf2f91c8d3d7f12 and use it as a guide to update your DI configuration.

SiteMapPreserveRouteDataAttribute Deprecated

The SiteMapPreserveRouteData attribute has gone the way of the Dodo bird. After careful analysis, it was determined that this attribute has no useful purpose. It is scheduled for removal in v5.

The recommended alternative is to use the preservedRouteParameters collection of the SiteMap node. For a detailed look at how to make this work, read How to Make MvcSiteMapProvider Remember a User's Position.

Change Log

  1. Bug: Fix for #223, no error message when parent node doesn't exist in the SiteMap. An error message is now shown with each orphan that couldn't be added to the SiteMap and detailed information about the origin of the node.
  2. Feature: Closes #114, specify order of nodes in the menu. Added an order property that can be used throughout the provider to control the order in the Menu and SiteMap HTML helpers.
  3. Bug: Fixed datatype of Attributes property in DynamicNode and MvcSiteMapNodeAttribute. It was IDictionary<string, string>, changed it to be IDictionary<string, object> so user-defined objects can more easily be added to the SiteMap nodes.
  4. Deprecated: SiteMapPreserveRouteDataAttribute was deprecated because upon careful analysis it has no real-world use. It apparently depended on writing data to the shared SiteMap cache in order to function. Allowing updates to the shared cache was a bug that was fixed with the release of 4.0.17.
  5. Enhancement: Made MvcSiteMapProvider_IncludeAssembliesForScan, MvcSiteMapProvider_AttributesToIgnore, and MvcSiteMapProvider_ControllerTypeResolverAreaNamespacesToIgnore configuration settings safer by trimming the whitespace between the value and delimiter.
  6. Enhancement: Added an error message when the .sitemap file doesn't have a root node defined.
  7. Feature: Added setting MvcSiteMapProvider_EnableSiteMapFile so XML file parsing can be disabled while using the internal DI container.
  8. Bug: Fixed the logic so it doesn't depend on the order the nodes are processed when adding Dynamic Nodes and MvcSiteMapNodeAttribute defined nodes to the SiteMap. This was causing nodes not to be added with no indication as to the cause. This change required a new interface to be created, ISiteMapNodeProvider and the following types were deprecated: XmlSiteMapBuilder, ReflectionSiteMapBuilder, AspNetSiteMapBuilder, DynamicNodeBuilder, and IDynamicNodeBuilder.
  9. Bug: Fixed instantiation of providers when using them in conjunction with MvcSiteMapNodeAttribute and the internal DI container.
  10. Feature: Added MvcSiteMapProvider_IncludeRootNodeFromSiteMapFile setting to allow parsing of the XML without including its root node. This allows multiple XML files to used to specify a single SiteMap.
  11. Bug: Fixed logic that processes Dynamic Nodes that are nested in the XML file so it only calls them 1 time per declaration (rather than N + 1 times, N being the number of nodes in the parent Dynamic Node provider).
  12. Added MvcSiteMapProvider_EnableSiteMapFileNestedDynamicNodeRecursion setting to enable V3 dynamic node recursion behavior, which called the nested dynamic node N+1 times (not sure why or how it could possibly be useful, but we need this setting on the off chance that someone is using it). The default behavior is to have this setting disabled, and we don't recommend enabling it unless you absolutely need the recursion for your application to work.
  13. Fixed implicit resource key by setting it to the SiteMapCacheKey as described in #228 as the "object key".

v4.2.0

02 Sep 13:16
Compare
Choose a tag to compare
  1. Enhancement: Changed logic of SiteMapLoader so passing null or empty string causes it to lookup the SiteMapCacheKey from ISiteMapCacheKeyGenerator rather than throw an ArgumentNullException. This makes it easier to implement features with an optional SiteMapCacheKey value.
  2. Feature: Added SiteMapCacheReleaseAttribute action filter attribute that can be used on controller actions to clear the cache after executing the controller action and before the view is processed.
  3. Bug: Fixed SiteMapCacheKey property on SiteMapTitleAttribute because it was not available publicly.
  4. Documentation: Added readme file to obsolete MvcSiteMapProvider package with instructions on how to remove it and/or replace it with the MvcSiteMapProvider.MVCx packages.
  5. Feature: Added a web.config setting named "MvcSiteMapProvider_EnableResolvedUrlCaching" for use with the internal DI container that can be used to globally disable URL resolution caching.
  6. Bug: AttributeDictionary was throwing exceptions when trying to add values from the presentation level. This was unintended, as it was supposed to allow changes that are valid only for the current request.
  7. Bug: Fixed visibility for /sitemap.xml endpoint so each URL will function individually rather than being blocked if the parent node doesn't have visibility. The ACL modules still block access to their child nodes as expected.
  8. Enhancement: In the /sitemap.xml endpoint, duplicate URLs are no longer sent to the output, as there would be no value in listing the same URL twice.
  9. Bug: In the /sitemap.xml endpoint, fixed the default baseUrl setting so it will take into consideration when an application is being hosted as a sub application.
  10. Enhancement: Removed unnecessary caching from SiteMapNodeUrlResolver.
  11. Bug: Fixed thread safety of the cache of ControllerTypeResolver.
  12. Bug: Fixed cache key names for RouteValueDictionary and AttributeDictionary.

v4.1.0

31 Aug 09:10
Compare
Choose a tag to compare
  1. Documentation: Added upgrade information to the readme file of each DI package.
  2. Documentation: Changed description of MvcSiteMapProvider legacy NuGet package to indicate it is now obsolete.
  3. Bug: Incorrectly resolved URLs in sitemaps XML when MvcSiteMapProvider is in sub application (#222).
  4. Bug: Fix for custom AuthorizeAttribute implementations that are sealed or have a non-public constructor (#156 and #220). Important Change: If your custom AuthorizeAttribute overrides OnAuthorization(), you must ensure that filterContext.Result is not null when authorization fails and is null when authorization succeeds.
  5. Feature: Refactored IRequestCache to inherit from ICache so other types of caches can be swapped.
  6. Bug: Added exception message in the case where the same key is added to RouteValues and PreservedRouteParameters on the same node.

Important Note: If you are using SimpleInjector, you must remove the following code from your DI module, or you will get compile time exceptions after installing this (or a future) version.

container.RegisterSingle<AuthorizeAttributeAclModule>(() => new AuthorizeAttributeAclModule(  
                                                          container.GetInstance<IMvcContextFactory>(),  
                                                          container.GetInstance<IObjectCopier>(),  
                                                          container.GetInstance<IControllerDescriptorFactory>(),  
                                                          container.GetInstance<IControllerBuilder>(),  
                                                          container.GetInstance<IAuthorizeAttributeBuilder>(),  
                                                          container.GetInstance<IGlobalFilterProvider>()));  

v4.0.17

28 Aug 19:22
Compare
Choose a tag to compare
  1. Extensibility: Changed open generic registration of cache providers in external DI modules so they can be extended without having to change configuration code. Please update your DI modules using the diff as a guide.
  2. Bug: Fix for issue described in #212, problem with preserved route parameters being written to the shared cache.
  3. Bug: Fix for #214, Area inheritance logic not working correctly for default non-area nodes.
  4. Feature: Added key property to SiteMapNodeModel View Model class to aid in building custom CSS schemes.