SkillAgentSearch skills...

Structuremap.MVC5

No description available

Install / Use

/learn @webadvanced/Structuremap.MVC5
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

#An MVC5 IDependencyResolver wrapper for Structuremap 3.x Works with MVC Controllers only. If you need WebApi Controler support install the Structuremap.WebApi2 package.

[What it adds to your solution]

2 directories to the root of your MVC project:

  • App_Start (If not already in your solution)
  • DependencyResolution

6 Files:

  • App_Start/StructuremapMvc.cs
  • DependencyResolution/StructureMapDependencyScope.cs
  • DependencyResolution/StructureMapScopeModule.cs
  • DependencyResolution/IoC.cs
  • DependencyResolution/ControllerConvention.cs
  • DependencyResolution/DefaultRegistry.cs (This is where you would define your mappings)

[Default configuration]

public DefaultRegistry() {
	Scan(
		scan => {
			scan.TheCallingAssembly();
			scan.WithDefaultConventions();
			scan.With(new ControllerConvention()); //Ensures a new Controller instance is created each time
		});
	//For<IExample>().Use<Example>();
}

This configuration will just work for any Interfaces and concrete implementations that follow the default convention and are part of the MVC project. I.E. ISomeService.cs implemented with SomeService.cs

View on GitHub
GitHub Stars21
CategoryDevelopment
Updated6y ago
Forks7

Languages

Puppet

Security Score

70/100

Audited on Apr 14, 2019

No findings