From 5250f0a48dcec79ec89927a7455e20892ba1940c Mon Sep 17 00:00:00 2001 From: Adem Date: Thu, 15 Nov 2018 17:17:17 +0300 Subject: [PATCH 1/4] postgresql added --- framework/Volo.Abp.sln | 7 +++++ ....Abp.EntityFrameworkCore.PostgreSql.csproj | 24 +++++++++++++++ ...onfigurationContextPostgreSqlExtensions.cs | 25 ++++++++++++++++ .../AbpDbContextOptionsSqlServerExtensions.cs | 30 +++++++++++++++++++ .../AbpEntityFrameworkCorePostgreSqlModule.cs | 12 ++++++++ 5 files changed, 98 insertions(+) create mode 100644 framework/src/Volo.Abp.EntityFrameworkCore.PostgreSql/Volo.Abp.EntityFrameworkCore.PostgreSql.csproj create mode 100644 framework/src/Volo.Abp.EntityFrameworkCore.PostgreSql/Volo/Abp/EntityFrameworkCore/AbpDbContextConfigurationContextPostgreSqlExtensions.cs create mode 100644 framework/src/Volo.Abp.EntityFrameworkCore.PostgreSql/Volo/Abp/EntityFrameworkCore/AbpDbContextOptionsSqlServerExtensions.cs create mode 100644 framework/src/Volo.Abp.EntityFrameworkCore.PostgreSql/Volo/Abp/EntityFrameworkCore/PostgreSql/AbpEntityFrameworkCorePostgreSqlModule.cs diff --git a/framework/Volo.Abp.sln b/framework/Volo.Abp.sln index 7cb5090f58..e4b3d032a4 100644 --- a/framework/Volo.Abp.sln +++ b/framework/Volo.Abp.sln @@ -210,6 +210,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Volo.Abp.Emailing.Tests", " EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy", "src\Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy\Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy.csproj", "{77A621CF-9562-411B-A707-C7C02CC3B8FA}" EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Volo.Abp.EntityFrameworkCore.PostgreSql", "src\Volo.Abp.EntityFrameworkCore.PostgreSql\Volo.Abp.EntityFrameworkCore.PostgreSql.csproj", "{882E82F1-1A57-4BB9-B126-4CBF700C8F0C}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -592,6 +594,10 @@ Global {77A621CF-9562-411B-A707-C7C02CC3B8FA}.Debug|Any CPU.Build.0 = Debug|Any CPU {77A621CF-9562-411B-A707-C7C02CC3B8FA}.Release|Any CPU.ActiveCfg = Release|Any CPU {77A621CF-9562-411B-A707-C7C02CC3B8FA}.Release|Any CPU.Build.0 = Release|Any CPU + {882E82F1-1A57-4BB9-B126-4CBF700C8F0C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {882E82F1-1A57-4BB9-B126-4CBF700C8F0C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {882E82F1-1A57-4BB9-B126-4CBF700C8F0C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {882E82F1-1A57-4BB9-B126-4CBF700C8F0C}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -693,6 +699,7 @@ Global {D91DE561-F403-416F-BD0B-DBF0BA1C4447} = {5DF0E140-0513-4D0D-BE2E-3D4D85CD70E6} {D3E07597-BB3D-4249-B873-607E2C128C0E} = {447C8A77-E5F0-4538-8687-7383196D04EA} {77A621CF-9562-411B-A707-C7C02CC3B8FA} = {5DF0E140-0513-4D0D-BE2E-3D4D85CD70E6} + {882E82F1-1A57-4BB9-B126-4CBF700C8F0C} = {5DF0E140-0513-4D0D-BE2E-3D4D85CD70E6} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {BB97ECF4-9A84-433F-A80B-2A3285BDD1D5} diff --git a/framework/src/Volo.Abp.EntityFrameworkCore.PostgreSql/Volo.Abp.EntityFrameworkCore.PostgreSql.csproj b/framework/src/Volo.Abp.EntityFrameworkCore.PostgreSql/Volo.Abp.EntityFrameworkCore.PostgreSql.csproj new file mode 100644 index 0000000000..386039ae19 --- /dev/null +++ b/framework/src/Volo.Abp.EntityFrameworkCore.PostgreSql/Volo.Abp.EntityFrameworkCore.PostgreSql.csproj @@ -0,0 +1,24 @@ + + + + + + netstandard2.0 + Volo.Abp.EntityFrameworkCore.SqlServer + Volo.Abp.EntityFrameworkCore.SqlServer + $(AssetTargetFallback);portable-net45+win8+wp8+wpa81; + false + false + false + + + + + + + + + + + + diff --git a/framework/src/Volo.Abp.EntityFrameworkCore.PostgreSql/Volo/Abp/EntityFrameworkCore/AbpDbContextConfigurationContextPostgreSqlExtensions.cs b/framework/src/Volo.Abp.EntityFrameworkCore.PostgreSql/Volo/Abp/EntityFrameworkCore/AbpDbContextConfigurationContextPostgreSqlExtensions.cs new file mode 100644 index 0000000000..953ac9e86e --- /dev/null +++ b/framework/src/Volo.Abp.EntityFrameworkCore.PostgreSql/Volo/Abp/EntityFrameworkCore/AbpDbContextConfigurationContextPostgreSqlExtensions.cs @@ -0,0 +1,25 @@ +using System; +using JetBrains.Annotations; +using Microsoft.EntityFrameworkCore; +using Npgsql.EntityFrameworkCore.PostgreSQL.Infrastructure; +using Volo.Abp.EntityFrameworkCore.DependencyInjection; + +namespace Volo.Abp.EntityFrameworkCore +{ + public static class AbpDbContextConfigurationContextPostgreSqlExtensions + { + public static DbContextOptionsBuilder UsePostgreSql( + [NotNull] this AbpDbContextConfigurationContext context, + [CanBeNull] Action sqlServerOptionsAction = null) + { + if (context.ExistingConnection != null) + { + return context.DbContextOptions.UseNpgsql(context.ExistingConnection, sqlServerOptionsAction); + } + else + { + return context.DbContextOptions.UseNpgsql(context.ConnectionString, sqlServerOptionsAction); + } + } + } +} diff --git a/framework/src/Volo.Abp.EntityFrameworkCore.PostgreSql/Volo/Abp/EntityFrameworkCore/AbpDbContextOptionsSqlServerExtensions.cs b/framework/src/Volo.Abp.EntityFrameworkCore.PostgreSql/Volo/Abp/EntityFrameworkCore/AbpDbContextOptionsSqlServerExtensions.cs new file mode 100644 index 0000000000..1849de4a8f --- /dev/null +++ b/framework/src/Volo.Abp.EntityFrameworkCore.PostgreSql/Volo/Abp/EntityFrameworkCore/AbpDbContextOptionsSqlServerExtensions.cs @@ -0,0 +1,30 @@ +using System; +using JetBrains.Annotations; +using Npgsql.EntityFrameworkCore.PostgreSQL.Infrastructure; + +namespace Volo.Abp.EntityFrameworkCore +{ + public static class AbpDbContextOptionsSqlServerExtensions + { + public static void UsePostgreSql( + [NotNull] this AbpDbContextOptions options, + [CanBeNull] Action sqlServerOptionsAction = null) + { + options.Configure(context => + { + context.UsePostgreSql(sqlServerOptionsAction); + }); + } + + public static void UsePostgreSql( + [NotNull] this AbpDbContextOptions options, + [CanBeNull] Action sqlServerOptionsAction = null) + where TDbContext : AbpDbContext + { + options.Configure(context => + { + context.UsePostgreSql(sqlServerOptionsAction); + }); + } + } +} \ No newline at end of file diff --git a/framework/src/Volo.Abp.EntityFrameworkCore.PostgreSql/Volo/Abp/EntityFrameworkCore/PostgreSql/AbpEntityFrameworkCorePostgreSqlModule.cs b/framework/src/Volo.Abp.EntityFrameworkCore.PostgreSql/Volo/Abp/EntityFrameworkCore/PostgreSql/AbpEntityFrameworkCorePostgreSqlModule.cs new file mode 100644 index 0000000000..4973af3966 --- /dev/null +++ b/framework/src/Volo.Abp.EntityFrameworkCore.PostgreSql/Volo/Abp/EntityFrameworkCore/PostgreSql/AbpEntityFrameworkCorePostgreSqlModule.cs @@ -0,0 +1,12 @@ +using Volo.Abp.Modularity; + +namespace Volo.Abp.EntityFrameworkCore.PostgreSql +{ + [DependsOn( + typeof(AbpEntityFrameworkCoreModule) + )] + public class AbpEntityFrameworkCorePostgreSqlModule : AbpModule + { + + } +} From 9bc776d231bf560afccfe6d855fed345b1861729 Mon Sep 17 00:00:00 2001 From: Adem Date: Thu, 15 Nov 2018 17:31:04 +0300 Subject: [PATCH 2/4] renamed --- ...bContextConfigurationContextPostgreSqlExtensions.cs | 6 +++--- ...s.cs => AbpDbContextOptionsPostgreSqlExtensions.cs} | 10 +++++----- 2 files changed, 8 insertions(+), 8 deletions(-) rename framework/src/Volo.Abp.EntityFrameworkCore.PostgreSql/Volo/Abp/EntityFrameworkCore/{AbpDbContextOptionsSqlServerExtensions.cs => AbpDbContextOptionsPostgreSqlExtensions.cs} (61%) diff --git a/framework/src/Volo.Abp.EntityFrameworkCore.PostgreSql/Volo/Abp/EntityFrameworkCore/AbpDbContextConfigurationContextPostgreSqlExtensions.cs b/framework/src/Volo.Abp.EntityFrameworkCore.PostgreSql/Volo/Abp/EntityFrameworkCore/AbpDbContextConfigurationContextPostgreSqlExtensions.cs index 953ac9e86e..1f86dfa480 100644 --- a/framework/src/Volo.Abp.EntityFrameworkCore.PostgreSql/Volo/Abp/EntityFrameworkCore/AbpDbContextConfigurationContextPostgreSqlExtensions.cs +++ b/framework/src/Volo.Abp.EntityFrameworkCore.PostgreSql/Volo/Abp/EntityFrameworkCore/AbpDbContextConfigurationContextPostgreSqlExtensions.cs @@ -10,15 +10,15 @@ namespace Volo.Abp.EntityFrameworkCore { public static DbContextOptionsBuilder UsePostgreSql( [NotNull] this AbpDbContextConfigurationContext context, - [CanBeNull] Action sqlServerOptionsAction = null) + [CanBeNull] Action 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); } } } diff --git a/framework/src/Volo.Abp.EntityFrameworkCore.PostgreSql/Volo/Abp/EntityFrameworkCore/AbpDbContextOptionsSqlServerExtensions.cs b/framework/src/Volo.Abp.EntityFrameworkCore.PostgreSql/Volo/Abp/EntityFrameworkCore/AbpDbContextOptionsPostgreSqlExtensions.cs similarity index 61% rename from framework/src/Volo.Abp.EntityFrameworkCore.PostgreSql/Volo/Abp/EntityFrameworkCore/AbpDbContextOptionsSqlServerExtensions.cs rename to framework/src/Volo.Abp.EntityFrameworkCore.PostgreSql/Volo/Abp/EntityFrameworkCore/AbpDbContextOptionsPostgreSqlExtensions.cs index 1849de4a8f..47967de15d 100644 --- a/framework/src/Volo.Abp.EntityFrameworkCore.PostgreSql/Volo/Abp/EntityFrameworkCore/AbpDbContextOptionsSqlServerExtensions.cs +++ b/framework/src/Volo.Abp.EntityFrameworkCore.PostgreSql/Volo/Abp/EntityFrameworkCore/AbpDbContextOptionsPostgreSqlExtensions.cs @@ -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 sqlServerOptionsAction = null) + [CanBeNull] Action postgreSqlOptionsAction = null) { options.Configure(context => { - context.UsePostgreSql(sqlServerOptionsAction); + context.UsePostgreSql(postgreSqlOptionsAction); }); } public static void UsePostgreSql( [NotNull] this AbpDbContextOptions options, - [CanBeNull] Action sqlServerOptionsAction = null) + [CanBeNull] Action postgreSqlOptionsAction = null) where TDbContext : AbpDbContext { options.Configure(context => { - context.UsePostgreSql(sqlServerOptionsAction); + context.UsePostgreSql(postgreSqlOptionsAction); }); } } From 2ec28964870bf9fec98d95f90d2d4311db4ddc65 Mon Sep 17 00:00:00 2001 From: Adem Date: Thu, 15 Nov 2018 17:44:16 +0300 Subject: [PATCH 3/4] assembly renamed --- .../Volo.Abp.EntityFrameworkCore.PostgreSql.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/framework/src/Volo.Abp.EntityFrameworkCore.PostgreSql/Volo.Abp.EntityFrameworkCore.PostgreSql.csproj b/framework/src/Volo.Abp.EntityFrameworkCore.PostgreSql/Volo.Abp.EntityFrameworkCore.PostgreSql.csproj index 386039ae19..a5fab7b5de 100644 --- a/framework/src/Volo.Abp.EntityFrameworkCore.PostgreSql/Volo.Abp.EntityFrameworkCore.PostgreSql.csproj +++ b/framework/src/Volo.Abp.EntityFrameworkCore.PostgreSql/Volo.Abp.EntityFrameworkCore.PostgreSql.csproj @@ -4,7 +4,7 @@ netstandard2.0 - Volo.Abp.EntityFrameworkCore.SqlServer + Volo.Abp.EntityFrameworkCore.PostgreSql Volo.Abp.EntityFrameworkCore.SqlServer $(AssetTargetFallback);portable-net45+win8+wp8+wpa81; false From 4cea0d93486f01f1a80246962977b0de1052eee6 Mon Sep 17 00:00:00 2001 From: Adem Date: Thu, 15 Nov 2018 17:46:42 +0300 Subject: [PATCH 4/4] packageid renamed --- .../Volo.Abp.EntityFrameworkCore.PostgreSql.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/framework/src/Volo.Abp.EntityFrameworkCore.PostgreSql/Volo.Abp.EntityFrameworkCore.PostgreSql.csproj b/framework/src/Volo.Abp.EntityFrameworkCore.PostgreSql/Volo.Abp.EntityFrameworkCore.PostgreSql.csproj index a5fab7b5de..062e74e325 100644 --- a/framework/src/Volo.Abp.EntityFrameworkCore.PostgreSql/Volo.Abp.EntityFrameworkCore.PostgreSql.csproj +++ b/framework/src/Volo.Abp.EntityFrameworkCore.PostgreSql/Volo.Abp.EntityFrameworkCore.PostgreSql.csproj @@ -5,7 +5,7 @@ netstandard2.0 Volo.Abp.EntityFrameworkCore.PostgreSql - Volo.Abp.EntityFrameworkCore.SqlServer + Volo.Abp.EntityFrameworkCore.PostgreSql $(AssetTargetFallback);portable-net45+win8+wp8+wpa81; false false