I noticed that when I installed StructureMap from NuGet into my ASP.NET MVC3 project, the Dave Ebbo WebActivator package was also added as a dependency.
WebActivator provides the PreApplicationStartMethod
attribute, and in the code template added during installation, it is used to initialize the IoC container and the dependent converter in its own class instead of doing this inside the Global.asax
Application_Start
method.
Given that ASP.NET 4 already has its own System.Web.PreApplicationStartMethodAttribute
, why did WebActivator have to provide its own version, and for StructureMap, use this?
I assume that I do not need to use the WebActivator option?
Added code for Darin:
using System.Web; using System.Web.Mvc; using StructureMap; [assembly: WebActivator.PreApplicationStartMethod( typeof(MyMvcApp.App_Start.StructuremapMvc), "Start")]
Kev
source share