예제 #1
0
        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>();
        }
예제 #2
0
        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);
        }