예제 #1
0
        protected override void OnConfigureServices(DependencyConfigurationContext context)
        {
            var identityBaseUri = context.ScopedConfiguration["IdentityBaseUrl"];
            var apiBaseUri      = context.ScopedConfiguration["ApiBaseUrl"];

            context.Logger.LogInformation("Leaderboard:PlayerManagementClient: using 'default' client with IdentityBaseUrl '{0}', ApiBaseUrl '{1}'", identityBaseUri, apiBaseUri);

            // could simplify this by requiring the client secret in the properties for PlayerManagementClient, but that duplicates config
            // Should revisit this approach when we try splitting out the services
            var clientSource = new Identity.Configuration.ConfigurationBasedClientSource(context.Logger);
            var clientSecret = clientSource.GetClientSecret(context.Configuration.GetSection("Identity:Clients"), "nether_identity");

            if (string.IsNullOrEmpty(clientSecret))
            {
                throw new Exception("Unable to determine the client secret for nether_identity");
            }

            context.Services.AddSingleton <ILeaderboardPlayerManagementClient, DefaultLeaderboardPlayerManagementClient>(serviceProvider =>
            {
                return(new DefaultLeaderboardPlayerManagementClient(
                           identityBaseUri,
                           apiBaseUri,
                           clientSecret,
                           serviceProvider.GetRequiredService <ILogger <DefaultLeaderboardPlayerManagementClient> >()
                           ));
            });
        }
예제 #2
0
        protected override void OnConfigureServices(DependencyConfigurationContext context)
        {
            // configure store and dependencies
            context.Services.AddTransient <IdentityContextBase, InMemoryIdentityContext>();
            context.Services.AddTransient <IUserStore, EntityFrameworkUserStore>();

            base.OnConfigureServices(context);
        }
예제 #3
0
        protected override void OnConfigureServices(DependencyConfigurationContext context)
        {
            string eventHubConnectionString = context.ScopedConfiguration["EventHubConnectionString"];

            context.Services.AddSingleton <IAnalyticsIntegrationClient>(serviceProvider =>
            {
                return(new AnalyticsIntegrationEventHubClient(eventHubConnectionString));
            });
        }
        protected override void OnConfigureServices(DependencyConfigurationContext context)
        {
            string baseUrl = context.ScopedConfiguration["AnalyticsBaseUrl"];

            context.Services.AddTransient <IAnalyticsIntegrationClient>(serviceProvider =>
            {
                return(new AnalyticsIntegrationHttpClient(baseUrl));
            });
        }
예제 #5
0
        protected override void OnConfigureServices(DependencyConfigurationContext context)
        {
            // configure store and dependencies
            context.Services.AddSingleton(context.ScopedConfiguration.Get <SqlIdentityContextOptions>());

            context.Services.AddTransient <IdentityContextBase, SqlIdentityContext>();
            context.Services.AddTransient <IUserStore, EntityFrameworkUserStore>();

            base.OnConfigureServices(context);
        }
        protected override void OnConfigureServices(DependencyConfigurationContext context)
        {
            // configure store and dependencies
            context.Services.AddSingleton(context.ScopedConfiguration.Get <SqlPlayerManagementContextOptions>());

            context.Services.AddTransient <PlayerManagementContextBase, SqlPlayerManagementContext>();
            context.Services.AddTransient <IPlayerManagementStore, EntityFrameworkPlayerManagementStore>();

            // configure type to perform migrations
            context.Services.AddSingleton <IDependencyInitializer <IPlayerManagementStore> >(this);
        }
        protected override void OnConfigureServices(DependencyConfigurationContext context)
        {
            var instrumentationKey = context.ScopedConfiguration["InstrumentationKey"];

            context.Logger.LogInformation("ApplicationPerformanceMonitor: using 'appinsights' client with InstrumentationKey '{0}'", instrumentationKey);
            context.Services.AddApplicationInsightsTelemetry(options =>
            {
                options.DeveloperMode      = context.HostingEnvironment.IsDevelopment();
                options.InstrumentationKey = instrumentationKey;
            });
            context.Services.AddTransient <IApplicationPerformanceMonitor, ApplicationInsightsMonitor>();
        }
        protected override void OnConfigureServices(DependencyConfigurationContext context)
        {
            string databaseName     = context.ScopedConfiguration["DatabaseName"];
            string connectionString = context.ScopedConfiguration["ConnectionString"];

            context.Services.AddTransient <IPlayerManagementStore>(serviceProvider =>
            {
                var storeLogger = serviceProvider.GetRequiredService <ILogger <MongoDBPlayerManagementStore> >();
                // TODO - look at encapsulating the connection info and registering that so that we can just register the type without the factory
                return(new MongoDBPlayerManagementStore(connectionString, databaseName, storeLogger));
            });
        }
 protected override void OnConfigureServices(DependencyConfigurationContext context)
 {
     // configure store and dependencies
     context.Services.AddTransient <PlayerManagementContextBase, InMemoryPlayerManagementContext>();
     context.Services.AddTransient <IPlayerManagementStore, EntityFrameworkPlayerManagementStore>();
 }
 protected override void OnConfigureServices(DependencyConfigurationContext context)
 {
     // configure type to perform migrations
     context.Services.AddSingleton <IDependencyInitializer <IUserStore> >(this);
 }
예제 #11
0
 protected override void OnConfigureServices(DependencyConfigurationContext context)
 {
     context.Services.AddSingleton <IApplicationPerformanceMonitor, NullMonitor>();
 }
 protected override void OnConfigureServices(DependencyConfigurationContext context)
 {
     // configure store and dependencies
     context.Services.AddTransient <LeaderboardContextBase, InMemoryLeaderboardContext>();
     context.Services.AddTransient <ILeaderboardStore, EntityFrameworkLeaderboardStore>();
 }
예제 #13
0
 protected override void OnConfigureServices(DependencyConfigurationContext context)
 {
     // configure store and dependencies
     context.Services.AddTransient <AnalyticsContextBase, InMemoryAnalyticsContext>();
     context.Services.AddTransient <IAnalyticsStore, EntityFrameworkAnalyticsStore>();
 }
예제 #14
0
 protected override void OnConfigureServices(DependencyConfigurationContext context)
 {
     context.Services.AddSingleton <IAnalyticsIntegrationClient, AnalyticsIntegrationNullClient>();
 }