private static Container DefaultContainer()
        {
            var c = new Container(x =>
            {
                x.AddRegistry <LoggerRegistry>();
                x.For <IConfigurationService>().Use <ConfigurationService>().Singleton();
                x.For <ITaskManager>().Use <TaskManager>().Singleton();
                x.For <IAsyncBackGroundWorker>().Use <AsyncBackGroundWorker>().Singleton();
                x.For <IFiboCaculator>().Use <SlowFiboCaculator>();
                x.For <IResultSender>().Use <MtBusSender>().Singleton();
            });

            var queueAddress = c.GetInstance <IConfigurationService>().GetValue("BusAddress");
            var bus          = MtBusConfigurationHelper.ConfigureMassTransit(queueAddress);

            c.Inject(bus);

            return(c);
        }
Example #2
0
        private static Container DefaultContainer()
        {
            var c = new Container(x =>
            {
                x.AddRegistry <LoggerRegistry>();
                x.For <IConfigurationService>().Use <ConfigurationService>().Singleton();
                x.For <IAsyncBackGroundWorker>().Use <AsyncBackGroundWorker>().Singleton();
                x.For <IFiboCaculator>().Use <SlowFiboCaculator>();
                x.For <ProcessingElementConsumer>().Singleton();
                x.For <ITaskManager>().Use <TaskManager>().Singleton();
                x.For <IResultSender>().Use <WebApiSender>().Singleton();
                x.For <MainApp>();
            });


            var queueAddress = c.GetInstance <IConfigurationService>().GetValue("BusAddress");
            var bus          = MtBusConfigurationHelper.ConfigureMassTransit(queueAddress, sbc => sbc.Subscribe(x => x.LoadFrom(c)));

            c.Inject(bus);

            return(c);
        }