Beispiel #1
0
        public static TinyIoCContainer Initialize(InputOptions inputOptions,
                                                  ILogger overrideLogger = null)
        {
            if (inputOptions == null)
            {
                throw new ArgumentNullException("inputOptions");
            }
            var ioc = new TinyIoCContainer();

            ILogger logger = overrideLogger ?? GetLogger(inputOptions.IsRequestingDebug);

            inputOptions.DumpValuesForDebug(logger);

            ioc.Register(ioc);
            ioc.Register(inputOptions);
            ioc.Register(logger);
            ioc.Register <WebServerLocation>().AsSingleton();
            ioc.Register <IStatLightRunnerFactory, StatLightRunnerFactory>();

            var eventAggregator = ioc.Resolve <EventAggregatorFactory>().Create();

            ioc.Register(eventAggregator);
            ioc.Register <IEventPublisher>(eventAggregator);
            ioc.Register <IEventSubscriptionManager>(eventAggregator);


            ioc.Register <ResponseFactory>().AsSingleton();

            ioc.Register <IPostHandler, PostHandler>().AsSingleton();
            ioc.Register <ICurrentStatLightConfiguration, CurrentStatLightConfiguration>();

            return(ioc);
        }