Question

I StructureMap as a way to do DI in my project. I want to create sitemap in my project. I install MvcSiteMapProvider MVC4 StructureMap Dependency Injection Configuration from NuGet. it requires manual config but I don't know how to config this.

thanks for your helps

Was it helpful?

Solution

If you installed MvcSiteMapProvider.MVC4.DI.StructureMap into your project, it does not require manual configuration. This package is for use when you don't already have DI in your project - it contains a composition root which is meant to be used as the single place to register all of your DI configuration for your entire project.

However, if you installed MvcSiteMapProvider.MVC4.DI.StructureMap.Modules into your project, it requires manual configuration. This package is meant to be used in projects that have a pre-existing DI setup. You just need to follow the instructions in the readme file in order to add it to your existing configuration. The exact procedure and could vary greatly from one project to another, but the readme contains all of the required and optional lines of code that will need to be added. The key is that you need to ensure that only 1 DI container is instantiated for the entire project and that all of the modules are registered with it.

Do note that MvcSiteMapProvider.MVC4.DI.StructureMap depends on MvcSiteMapProvider.MVC4.DI.StructureMap.Modules, so you can easily downgrade with a single package manager command.

PM> Uninstall-Package MvcSiteMapProvider.MVC4.DI.StructureMap

Make sure you don't use the -RemoveDependencies option.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top