예제 #1
0
        public Bootstrap(string boostrapFile)
        {
            ILoggerRepository repository             = LogManager.CreateRepository(LogConst.SCRAPY_CORE_REPO);
            ILoggerRepository repositoryFundalmental = LogManager.CreateRepository(LogConst.SCRAPY_FUNDAMENTAL);

            log4net.Config.XmlConfigurator.Configure(repository, new FileInfo("log4net.config"));
            log4net.Config.XmlConfigurator.Configure(repositoryFundalmental, new FileInfo("log4net-fundamental.config"));

            logger = LogManager.GetLogger(repository.Name, typeof(Bootstrap));
            string location        = Assembly.GetCallingAssembly().Location;
            var    applicationPath = Path.GetDirectoryName(location);

            logger.Debug("Application Location:" + applicationPath);

            ////TODO :Temp state here, refactor to other way.
            ElasticSearchTypeManager.RegistAssemblyModels(Assembly.LoadFrom(Path.Combine(applicationPath, "ScrapyCore.Fundamental.dll")));

            initialStorage = StorageFactory.Factory.GetLocalStorage(applicationPath);
            var model = JsonConvert.DeserializeObject <Model>(initialStorage.GetString(boostrapFile));

            Provisioning      = new ProvisioningModel(model, initialStorage);
            InjectionProvider = new InjectionProvider(this);
            HostedMachine     = HotedMachineManager.GetHostedMachine(this.GetVariableSet("environment"));
        }
예제 #2
0
 public InjectedFieldModel(FieldInfo injectedField, InjectionAttribute injectionAttribute)
 {
     this.injectedField      = new Field(injectedField);
     this.injectionAttribute = injectionAttribute;
     this.injectionProvider  = InjectionProviderLookup.ProviderFor(injectionAttribute);
 }
예제 #3
0
 public InjectedFieldModel(FieldInfo injectedField, InjectionAttribute injectionAttribute)
 {
     this.injectedField = new Field(injectedField);
     this.injectionAttribute = injectionAttribute;
     this.injectionProvider = InjectionProviderLookup.ProviderFor(injectionAttribute);
 }