
Security News
ECMAScript 2025 Finalized with Iterator Helpers, Set Methods, RegExp.escape, and More
ECMAScript 2025 introduces Iterator Helpers, Set methods, JSON modules, and more in its latest spec update approved by Ecma in June 2025.
MvcSiteMapProvider.MVC3.DI.Autofac.Modules
Advanced tools
Dependency injection modules for Autofac that can be used to integrate MvcSiteMapProvider into an existing dependency injection setup. You may customize this configuration to allow for replacement of virtually any part of MvcSiteMapProvider by implementing one of its interfaces and injecting an instance of your implementation. This package requires manual configuration to integrate with Autofac, but is the least invasive option that won't bypass any existing DI bootstrapping code.
To add MvcSiteMapProvider to your DI configuration, add the following code to your composition root.
// Create a container builder (typically part of your DI setup already)
var builder = new ContainerBuilder();
// Register modules
builder.RegisterModule(new MvcSiteMapProviderModule()); // Required
builder.RegisterModule(new MvcModule()); // Required by MVC. Typically already part of your setup (double check the contents of the module).
// Create the DI container (typically part of your config already)
var container = builder.Build();
// Setup global sitemap loader (required)
MvcSiteMapProvider.SiteMaps.Loader = container.Resolve<ISiteMapLoader>();
// Check all configured .sitemap files to ensure they follow the XSD for MvcSiteMapProvider (optional)
var validator = container.Resolve<ISiteMapXmlValidator>();
validator.ValidateXml(HostingEnvironment.MapPath("~/Mvc.sitemap"));
// Register the Sitemaps routes for search engines (optional)
XmlSiteMapController.RegisterRoutes(RouteTable.Routes);
For more help consult the Autofac documentation at http://code.google.com/p/autofac/wiki/StructuringWithModules
Making MvcSiteMapProvider depend on DI is a bit of a double-edged sword. While this makes MvcSiteMapProvider extremely easy to extend, it is possible that new features added to MvcSiteMapProvider will cause your existing DI configuration to break when doing an upgrade.
Unfortunately, NuGet doesn't have a way to automatically merge changes into your DI modules - if you have changed your configuration in any way, the module will be skipped when you upgrade. But then, the purpose of giving you this code is so you can change it. For this reason, when you upgrade your MvcSiteMapProvider version, you should also compare your DI module to the corresponding module in the master branch to see if there are any changes that need to be made to your configuration. The best way to do this is to use some kind of diff tool (such as Beyond Compare) to highlight the differences and assist with bringing the changes into your configuration without overwriting your customizations.
Note that you don't need to merge in #if, #else, and #endif blocks inside of the module, but only the code between them that applies to your specific .NET and/or MVC version.
The latest module for Autofac is located at the following location:
FAQs
Dependency injection modules for Autofac that can be used to integrate MvcSiteMapProvider into an existing dependency injection setup. You may customize this configuration to allow for replacement of virtually any part of MvcSiteMapProvider by implementing one of its interfaces and injecting an instance of your implementation. This package requires manual configuration to integrate with Autofac, but is the least invasive option that won't bypass any existing DI bootstrapping code.
We found that mvcsitemapprovider.mvc3.di.autofac.modules demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
ECMAScript 2025 introduces Iterator Helpers, Set methods, JSON modules, and more in its latest spec update approved by Ecma in June 2025.
Security News
A new Node.js homepage button linking to paid support for EOL versions has sparked a heated discussion among contributors and the wider community.
Research
North Korean threat actors linked to the Contagious Interview campaign return with 35 new malicious npm packages using a stealthy multi-stage malware loader.