public static ISsoConfigurationBuilder AddDatabase(this ISsoConfigurationBuilder services, DatabaseType database, string connString) { switch (database) { case DatabaseType.MySql: services.WithMySql(connString).AddEventStoreMySql(connString, EventStoreMigrationOptions.Get().ShouldMigrate(false)); break; case DatabaseType.SqlServer: services.WithSqlServer(connString).AddEventStoreSqlServer(connString, EventStoreMigrationOptions.Get().ShouldMigrate(false)); break; case DatabaseType.Postgre: services.WithPostgreSql(connString).AddEventStorePostgreSql(connString, EventStoreMigrationOptions.Get().ShouldMigrate(false)); break; case DatabaseType.Sqlite: services.WithSqlite(connString).AddEventStoreSqlite(connString, EventStoreMigrationOptions.Get().ShouldMigrate(false)); break; } return services; }
protected override void ConfigureWebHost(IWebHostBuilder builder) { ConfigureIdentityServer(); builder.ConfigureServices(services => { // Add a database context (AppDbContext) using an in-memory database for testing. void DatabaseOptions(DbContextOptionsBuilder opt) => opt.UseInMemoryDatabase("JpTests").EnableSensitiveDataLogging(); services.ConfigureUserIdentity<AspNetUserTest>().WithSqlServer(DatabaseOptions); services.AddEventStoreContext(DatabaseOptions, EventStoreMigrationOptions.Get().ShouldMigrate(false)); services.ConfigureJpAdmin<AspNetUserTest>().WithSqlServer(DatabaseOptions); services.PostConfigureAll<IdentityServerAuthenticationOptions>(options => { options.Authority = "http://localhost"; options.JwtBackChannelHandler = IdentityServerClient.IdentityServer.CreateHandler(); }); }).UseStartup<StartupTest>(); }