Created
October 31, 2013 10:50
-
-
Save benfoster/7247748 to your computer and use it in GitHub Desktop.
1 asp.net DI
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class StructureMapConfig | |
{ | |
public static void Register() | |
{ | |
ObjectFactory.Initialize(cfg => | |
{ | |
cfg.Scan(scan => | |
{ | |
scan.LookForRegistries(); | |
scan.TheCallingAssembly(); | |
}); | |
}); | |
// Set up Microsoft's "1 asp.net" service locators | |
System.Web.Mvc.DependencyResolver.SetResolver(new StructureMapDependencyResolver(ObjectFactory.Container)); | |
System.Web.Http.GlobalConfiguration.Configuration.DependencyResolver = new StructureMapApiDependencyResolver(ObjectFactory.Container); | |
Microsoft.AspNet.SignalR.GlobalHost.DependencyResolver = new StructureMapSignalRDependencyResolver(ObjectFactory.Container); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment