Created
May 17, 2010 14:54
-
-
Save hyrmn/403858 to your computer and use it in GitHub Desktop.
This file contains 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
ObjectFactory.Initialize(i => | |
{ | |
i.IgnoreStructureMapConfig = true; | |
i.AddRegistry(new NHibernateRegistry()); | |
i.Scan(s => | |
{ | |
s.Assembly("Hyrmn.Web"); | |
s.WithDefaultConventions(); | |
}); | |
i.For<IEmailer>().Use<Emailer>() | |
.Ctor<string>("username").EqualToAppSetting("emailUsername") | |
.Ctor<string>("password").EqualToAppSetting("emailPassword"); | |
i.For<IAuthenticationService>().Singleton().Use<FormsAuthenticationService>(); | |
}); | |
public class StructureMapControllerFactory : DefaultControllerFactory | |
{ | |
protected override IController GetControllerInstance(RequestContext requestContext, Type controllerType) | |
{ | |
if (controllerType != null) | |
return ObjectFactory.GetInstance(controllerType) as Controller; | |
return base.GetControllerInstance(requestContext, controllerType); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment