コード例 #1
0
        private static void ConfigureServices(IServiceCollection services)
        {
            services.AddHostedService <AppService>();
            services.AddSingleton <FixtureDetailsListener>();
            services.AddSingleton <LeagueSummaryListener>();
            services.AddSingleton <LeagueSummaryScraper>();
            services.AddSingleton <FixtureDetailsScraper>();

            var chromeSettings = new ChromeSettings
            {
                Host = Configuration["ChromeRemoteDebuggingHost"],
                Port = Configuration["ChromeRemoteDebuggingPort"]
            };

            services.AddSingleton(chromeSettings);
            services.AddSingleton <ChromeHelper>();

            var dbInfo = new DatabaseConnectionInfo
            {
                ConnectionString = Configuration.GetConnectionString("Football")
            };

            services.AddSingleton(dbInfo);

            var amqpUri = new Uri(Configuration.GetConnectionString("AMQP"));

            services.AddSingleton(amqpUri);
            services.AddSingleton <IAmqpService, AmqpService>();
            services.AddSingleton <IConnectionProvider, ConnectionProvider>();
            services.AddSingleton <ICompetitionRepository, CompetitionRepository>();
            services.AddSingleton <IPlayerRepository, PlayerRepository>();
            services.AddSingleton <IPlayerSummaryRepository, PlayerSummaryRepository>();
            services.AddSingleton <ITeamRepository, TeamRepository>();
            services.AddSingleton <ITeamSummaryRepository, TeamSummaryRepository>();
            services.AddSingleton <IFixtureRepository, FixtureRepository>();

            services.AddSingleton <ILeagueSummaryManager, LeagueSummaryManager>();
            services.AddSingleton <IFixtureDetailsManager, FixtureDetailsManager>();
        }
コード例 #2
0
 public ChromeHelper(ILogger <ChromeHelper> logger, ChromeSettings chromeSettings, IConfiguration configuration)
 {
     _logger         = logger;
     _chromeSettings = chromeSettings;
     _configuration  = configuration;
 }