pull/598/head
Adem 6 years ago
parent 5250f0a48d
commit 9bc776d231

@ -10,15 +10,15 @@ namespace Volo.Abp.EntityFrameworkCore
{
public static DbContextOptionsBuilder UsePostgreSql(
[NotNull] this AbpDbContextConfigurationContext context,
[CanBeNull] Action<NpgsqlDbContextOptionsBuilder> sqlServerOptionsAction = null)
[CanBeNull] Action<NpgsqlDbContextOptionsBuilder> postgreSqlOptionsAction = null)
{
if (context.ExistingConnection != null)
{
return context.DbContextOptions.UseNpgsql(context.ExistingConnection, sqlServerOptionsAction);
return context.DbContextOptions.UseNpgsql(context.ExistingConnection, postgreSqlOptionsAction);
}
else
{
return context.DbContextOptions.UseNpgsql(context.ConnectionString, sqlServerOptionsAction);
return context.DbContextOptions.UseNpgsql(context.ConnectionString, postgreSqlOptionsAction);
}
}
}

@ -4,26 +4,26 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Infrastructure;
namespace Volo.Abp.EntityFrameworkCore
{
public static class AbpDbContextOptionsSqlServerExtensions
public static class AbpDbContextOptionsPostgreSqlExtensions
{
public static void UsePostgreSql(
[NotNull] this AbpDbContextOptions options,
[CanBeNull] Action<NpgsqlDbContextOptionsBuilder> sqlServerOptionsAction = null)
[CanBeNull] Action<NpgsqlDbContextOptionsBuilder> postgreSqlOptionsAction = null)
{
options.Configure(context =>
{
context.UsePostgreSql(sqlServerOptionsAction);
context.UsePostgreSql(postgreSqlOptionsAction);
});
}
public static void UsePostgreSql<TDbContext>(
[NotNull] this AbpDbContextOptions options,
[CanBeNull] Action<NpgsqlDbContextOptionsBuilder> sqlServerOptionsAction = null)
[CanBeNull] Action<NpgsqlDbContextOptionsBuilder> postgreSqlOptionsAction = null)
where TDbContext : AbpDbContext<TDbContext>
{
options.Configure<TDbContext>(context =>
{
context.UsePostgreSql(sqlServerOptionsAction);
context.UsePostgreSql(postgreSqlOptionsAction);
});
}
}
Loading…
Cancel
Save