public static IJpProjectAdminBuilder AddEventStorePostgreSql(this IJpProjectAdminBuilder services, string connectionString)
        {
            var migrationsAssembly = typeof(DatabaseConfig).GetTypeInfo().Assembly.GetName().Name;

            services.Services.AddDbContext <EventStoreContext>(opt => opt.UseNpgsql(connectionString, sql => sql.MigrationsAssembly(migrationsAssembly)));

            return(services);
        }
Beispiel #2
0
        public static IJpProjectAdminBuilder WithSqlServer(this IJpProjectAdminBuilder services, string connectionString, JpDatabaseOptions options = null)
        {
            var migrationsAssembly = typeof(DatabaseConfig).GetTypeInfo().Assembly.GetName().Name;

            services.Services.AddEntityFrameworkSqlServer().AddAdminContext(opt => opt.UseSqlServer(connectionString, sql => sql.MigrationsAssembly(migrationsAssembly)), options);

            return(services);
        }
        public static IJpProjectAdminBuilder AddDatabase(this IJpProjectAdminBuilder services, DatabaseType database, string connString)
        {
            switch (database)
            {
            case DatabaseType.MySql:
                services.WithMySql(connString).AddEventStoreMySql(connString);
                break;

            case DatabaseType.SqlServer:
                services.WithSqlServer(connString).AddEventStoreSqlServer(connString);
                break;

            case DatabaseType.Postgre:
                services.WithPostgreSql(connString).AddEventStorePostgreSql(connString);
                break;

            case DatabaseType.Sqlite:
                services.WithSqlite(connString).AddEventStoreSqlite(connString);
                break;
            }

            return(services);
        }
Beispiel #4
0
        public static IJpProjectAdminBuilder WithSqlServer(this IJpProjectAdminBuilder services, Action <DbContextOptionsBuilder> optionsAction, JpDatabaseOptions options = null)
        {
            services.Services.AddAdminContext(optionsAction, options);

            return(services);
        }