private static void RegisterServices(this Container container, HiLaarischSettings settings) { container.RegisterSingleton <IApplicationDeployment>(() => new ApplicationDeployment(settings.ApplicationPhase)); #if DEBUG var fakeMailServicePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Desktop), "HiLaarIsch Email Confirmation.txt"); container.RegisterSingleton <IMessageService>(() => new FakeEmailService(fakeMailServicePath)); #else container.RegisterSingleton <IMessageService>(() => new SendGridEmailService(container.GetInstance <IApplicationDeployment>(), settings.EmailAddresses, settings.ApiKeys.SendGrid)); #endif container.RegisterSingleton <UserManager.CommandHandlers>(); }
public static Container GetInitializedContainer(IAppBuilder app, HiLaarischSettings settings) { var container = new Container(); container.Options.DefaultScopedLifestyle = new WebRequestLifestyle(); container.RegisterServices(settings); container.RegisterQueryHandlers(); container.RegisterCommandHandlers(); container.RegisterDataServices(settings.ConnectionString); container.RegisterOwinIdentityServices(app); container.RegisterLoggers(); return(container); }