Exemplo n.º 1
0
        public CompositionRoot()
        {
            var settings = new EdgarSettings();

            _container = new Container(
                config =>
            {
                ConfigureLogger(config, settings);

                config.For <IHttpDataAgent>().Use <HttpDataAgent>();

                config.For <IUtil>().Use <Util>();

                config.For <IEdgarApi>().Use <EdgarApi>()
                .Ctor <string>("connectionString").Is(settings.AiDollarMongo)
                .Ctor <string>("database").Is(settings.AiDollarDb);

                config.For <IDbOperation>().Use <MongoDbOperation>()
                .Ctor <string>("connectionString").Is(settings.AiDollarMongo)
                .Ctor <string>("database").Is(settings.AiDollarDb);

                config.For <IService>().Use <EdgarService>()
                .Ctor <string[]>("ciks").Is(settings.Ciks)
                .Ctor <string>("edgarUri").Is(settings.EdgarArchiveRoot)
                .Ctor <string>("outputPath").Is(settings.DataPath)
                .Ctor <string>("posPage").Is(settings.PosPage);
            }
                );
        }
Exemplo n.º 2
0
        protected virtual void ConfigureLogger(ConfigurationExpression config, EdgarSettings settings)
        {
            var logger = BackgroundWorkerFactory.Logger ?? new Log4NetLogger(settings.LogPath, settings.LogFilename, settings.LogArchivePath);

            config.For <ILogger>().Use(logger);
            config.Policies.FillAllPropertiesOfType <ILogger>();
            BackgroundWorkerFactory.Logger = logger;
        }