コード例 #1
0
ファイル: IoCTests.cs プロジェクト: ealeksandrovich/Framework
        public virtual void InitTest()
        {
            IocContainerProvider.InitIoc();

            var obj = IocContainerProvider.CurrentContainer.GetInstance <TestClass>();

            Assert.AreNotEqual(1, obj.GetOne());
        }
コード例 #2
0
        public void SetUp()
        {
            IocContainerProvider.InitIoc();

            var modelElementStorage = new Moq.Mock <IModelElementStorage>();

            modelElementStorage.Setup(x => x.GetModelElementTree(It.IsAny <string>()))
            .Returns((string x) => AllClassDescriptions.FirstOrDefault(y => y.DisplayText == x));

            this.dynamicApiWarder = new DynamicApiWarder(modelElementStorage.Object);
        }
コード例 #3
0
        public virtual void Start()
        {
            this.logger.Info("IoC initializing....");
            IocContainerProvider.InitIoc();
            IocContainerProvider.CurrentContainer.Verify();
            this.logger.Info("IoC initialized.");

            this.logger.Info("Service starting");
            var serviceUrl = ConfigurationManager.AppSettings["serviceUrl"];

            this.owinWeb = WebApp.Start <Startup>(serviceUrl);
            this.logger.Info("Service started");
        }
コード例 #4
0
ファイル: IocConfig.cs プロジェクト: benyusouf/BanklyDemo
        public static IServiceProvider AddDependencies(this IServiceCollection services)
        {
            var containerBuilder = new ContainerBuilder();

            RegisterDependencies(containerBuilder);

            services.AddMemoryCache();

            containerBuilder.Populate(services);

            var container = containerBuilder.Build();

            IocContainerProvider.Register(container);

            return(new AutofacServiceProvider(container));
        }
コード例 #5
0
        public static void Main(string[] args)
        {
            var builder = new ConfigurationBuilder()
                          .SetBasePath(Directory.GetCurrentDirectory())
                          .AddJsonFile("appsettings.json");

            var cfg = builder.Build();

            LoadExtensions();

            Logger.Info("IoC initializing....");
            try
            {
                IocContainerProvider.InitIoc(cfg);
                IocContainerProvider.CurrentContainer.Verify();
            }
            catch (ReflectionTypeLoadException ex)
            {
                if (ex.LoaderExceptions != null)
                {
                    foreach (var loaderException in ex.LoaderExceptions)
                    {
                        Logger.Error(loaderException);
                    }
                }
                throw;
            }
            Logger.Info("IoC initialized.");

            InitExtensions(cfg);

            var agentManager = IocContainerProvider.CurrentContainer.GetInstance <IAgentManager>();

            agentManager.StartManager();

            var wait = new ManualResetEvent(false);

            Console.CancelKeyPress += (sender, eventArgs) => wait.Set();

            Logger.Info("The service is now running, press Control+C to exit.");
            wait.WaitOne();
        }
コード例 #6
0
        public override void Start()
        {
            this.logger.Info("IoC initializing....");
            IocContainerProvider.InitIoc();
            IocContainerProvider.CurrentContainer.Verify();
            this.logger.Info("IoC initialized.");

            PlatformBusFactory.RedButton.Invoke();
            this.logger.Info("Service started");

            this.platformBus  = IocContainerProvider.CurrentContainer.GetInstance <IPlatformBus>();
            this.dataProvider = IocContainerProvider.CurrentContainer.GetInstance <AttemptDataProvider>();

            //HangfireBootstrapper.Instance.Start();

            //IocContainerProvider.CurrentContainer.GetInstance<ISendRetryStrategy>().RetryMessagePublish();
            //IocContainerProvider.CurrentContainer.GetInstance<IConsumeRetryStrategy>().RetryConsumerMessage();

            TestOne();
        }
コード例 #7
0
ファイル: OwinService.cs プロジェクト: bychkovav/microtools
        public virtual void Start()
        {
            if (Directory.Exists(DynamicLibPath))
            {
                foreach (var dll in Directory.GetFiles(DynamicLibPath, "*.dll"))
                {
                    var ass = Assembly.LoadFrom(dll);
                    this.logger.Info($"LOADING EXTENSION {ass}");
                    if (ass.Location != null)
                    {
                        AppDomain.CurrentDomain.Load(AssemblyName.GetAssemblyName(ass.Location));
                    }
                    else
                    {
                        this.logger.Error($"ERROR LOADING EXTENSION {ass}: Assembly.Location property is null");
                    }
                }
            }
            else
            {
                this.logger.Warn("NO EXTENSIONS FOUND");
            }

            this.logger.Info("IoC initializing....");
            IocContainerProvider.InitIoc();
            IocContainerProvider.CurrentContainer.Verify();
            this.logger.Info("IoC initialized.");

            IocContainerProvider.CurrentContainer.GetInstance <ManagerInitializer>().StartManager();
            PlatformBusFactory.RedButton.Invoke();
            this.logger.Info("Service started");

            var serviceUrl = ConfigurationManager.AppSettings["serviceUrl"];

            this.owinWeb = WebApp.Start(new StartOptions()
            {
                AppStartup = typeof(OwinStartup).AssemblyQualifiedName,
                Urls       = { serviceUrl }
            });
        }
コード例 #8
0
ファイル: TestBase.cs プロジェクト: bychkovav/microtools
 public virtual void SetUp()
 {
     IocContainerProvider.InitIoc();
 }
コード例 #9
0
 static TestBase()
 {
     IocContainerProvider.InitIoc();
 }