Exemplo n.º 1
0
        public void ConfigureDevelopmentServices(IServiceCollection services)
        {
            var appSettings       = this.getSettings(services);
            var secretAppSettings = new SecretAppSettings(Configuration, appSettings);

            // For development env, it use in memory database
            services.ConfigureDbContext(secretAppSettings, development: true);
            ConfigureServices(services);
        }
Exemplo n.º 2
0
        public void ConfigureProductionServices(IServiceCollection services)
        {
            var appSettings       = this.getSettings(services);
            var secretAppSettings = new SecretAppSettings(Configuration, appSettings);

            // For producation env, it use SQL database.
            // TODO: add connection string for data/identity in App settings.
            // TODO: support azure key vault support.
            services.ConfigureDbContext(secretAppSettings, development: false);
            ConfigureServices(services);
        }
Exemplo n.º 3
0
 public static void ConfigureDbContext(this IServiceCollection services, SecretAppSettings secretAppSettings, bool development = false)
 {
     if (development)
     {
         services.AddDbContext <AppIdentityDbContext>(
             options => options.UseInMemoryDatabase("Identity")
             );
     }
     else
     {
         services.AddDbContext <AppIdentityDbContext>(
             options => options.UseSqlServer(secretAppSettings.IdentityConnectionString)
             );
     }
 }