Пример #1
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddSingleton <IHostedService, MatchDataCollectionService>();
            services.AddSingleton <ILogging, Logging>();
            services.AddSingleton <IThrottledRequestHelper, ThrottledRequestHelper>();

            services.AddSingleton <IRiotApi>(RiotApi.GetDevelopmentInstance("RGAPI-ae48adb7-5934-4272-8afb-7d8f9aa6cf4a"));
            services.AddSingleton <IStaticDataEndpoints>(StaticDataEndpoints.GetInstance("RGAPI-ae48adb7-5934-4272-8afb-7d8f9aa6cf4a"));

            services.AddTransient <ISummonerRepository, SummonerRepository>();
            services.AddTransient <IBasicMatchupInformationRepository, BasicMatchupInformationRepository>();
            services.AddTransient <ICachedCalculatedMatchupInformationRepository, CachedCalculatedMatchupInformationRepository>();
            services.AddTransient <IChampionStaticDataRepository, ChampionStaticDataRepository>();
            services.AddTransient <IItemStaticDataRepository, ItemStaticDataRepository>();
            services.AddTransient <ISummonerSpellStaticDataRepository, SummonerSpellStaticDataRepository>();
            services.AddTransient <IRunesStaticDataRepository, RunesStaticDataRepository>();
            services.AddTransient <IMatchControllerUtils, MatchControllerUtils>();


            var dbConn = @"Server=(localdb)\mssqllocaldb;Database=LccDatabase;Trusted_Connection=True;ConnectRetryCount=0";

            services.AddDbContext <LccDatabaseContext>(options => options.UseSqlServer(dbConn));

            services.AddMvc();
        }
Пример #2
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddSingleton <IHostedService, MatchDataCollectionService>();
            services.AddSingleton <IThrottledRequestHelper, ThrottledRequestHelper>();
            services.AddScoped <IStaticDataCollectionService, StaticDataCollectionService>();

            services.AddSingleton <IRiotApi>(RiotApi.GetDevelopmentInstance(RiotApiKey));
            services.AddSingleton <IStaticDataEndpoints>(StaticDataEndpoints.GetInstance(RiotApiKey));

            services.AddScoped <IMatchProvider, MatchProvider>();

            var dbConn = @"Server=(localdb)\mssqllocaldb;Database=LccDatabase;Trusted_Connection=True;ConnectRetryCount=0";

            services.AddDbContext <DatabaseContext>(options => options.UseSqlServer(dbConn));

            services.AddMvc();

            services.AddMvcCore()
            .AddAuthorization()
            .AddJsonFormatters();

            services.AddAuthentication("Bearer")
            .AddIdentityServerAuthentication(options =>
            {
                options.Authority            = "http://localhost:5000";
                options.RequireHttpsMetadata = false;

                options.ApiName = "LccApi";
            });
        }
Пример #3
0
        private RiotApi(string apiKey, IDictionary <TimeSpan, int> rateLimits)
        {
            Requesters.RiotApiRequester = new RateLimitedRequester(apiKey, rateLimits);
            var requester = Requesters.RiotApiRequester;

            Summoner        = new SummonerEndpoint(requester, _cache);
            Champion        = new ChampionEndpoint(requester);
            Masteries       = new MasteriesEndpoint(requester);
            Runes           = new RunesEndpoint(requester);
            League          = new LeagueEndpoint(requester);
            Match           = new MatchEndpoint(requester, _cache);
            Spectator       = new SpectatorEndpoint(requester);
            ChampionMastery = new ChampionMasteryEndpoint(requester);
            ThirdParty      = new ThirdPartyEndpoint(requester);
            Static          = StaticDataEndpoints.GetInstance(apiKey, true);
        }
Пример #4
0
        public StaticRiotApiTest()
        {
            var cache = new Cache();

            _api = StaticDataEndpoints.GetInstance(Requester.ApiKey, true);
        }