Exemple #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="LazyManChannel"/> class.
        /// </summary>
        /// <param name="httpClientFactory">Instance of the <see cref="IHttpClientFactory"/> interface.</param>
        /// <param name="loggerFactory">Instance of the <see cref="ILoggerFactory"/> interface.</param>
        /// <param name="powerSportsApi">Instance of the <see cref="PowerSportsApi"/>.</param>
        public LazyManChannel(IHttpClientFactory httpClientFactory, ILoggerFactory loggerFactory, PowerSportsApi powerSportsApi)
        {
            _logger = loggerFactory.CreateLogger <LazyManChannel>();
            var statsApiLogger = loggerFactory.CreateLogger <StatsApi>();

            _nhlStatsApi    = new StatsApi(httpClientFactory, statsApiLogger, "nhl");
            _mlbStatsApi    = new StatsApi(httpClientFactory, statsApiLogger, "MLB");
            _powerSportsApi = powerSportsApi;

            _gameCache = new ConcurrentDictionary <string, CacheItem <List <Game> > >();
        }
        public LazyManChannel(IHttpClient httpClient, IJsonSerializer jsonSerializer, ILogManager logManager)
        {
            _logger = logManager.GetLogger(GetType().Name);

            _nhlStatsApi = new StatsApi(httpClient, _logger, jsonSerializer, "nhl");
            _mlbStatsApi = new StatsApi(httpClient, _logger, jsonSerializer, "MLB");

            _powerSportsApi = new PowerSportsApi(httpClient, _logger);

            _jsonSerializer = jsonSerializer;
            _gameCache      = new ConcurrentDictionary <string, CacheItem <List <Game> > >();
        }