Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DB providers splitted to projects #1031

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 32 additions & 2 deletions SimplCommerce.sln
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.29020.237
# Visual Studio Version 17
VisualStudioVersion = 17.1.32421.90
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{C9BFDDC4-5671-47A3-B57D-197C2A51FA8A}"
EndProject
Expand Down Expand Up @@ -134,6 +134,10 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SimplCommerce.Module.Paymen
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SimplCommerce.Module.PaymentCashfree", "src\Modules\SimplCommerce.Module.PaymentCashfree\SimplCommerce.Module.PaymentCashfree.csproj", "{E30CF10F-FABF-4917-8BEB-CB81E4CE2C92}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SimplCommerce.Db.MsSql", "src\SimplCommerce.Db.MsSql\SimplCommerce.Db.MsSql.csproj", "{2FD1634B-E0ED-4E68-A993-57AAEF2B9474}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SimplCommerce.Db.PgSql", "src\SimplCommerce.Db.PgSql\SimplCommerce.Db.PgSql.csproj", "{61985132-75C9-4601-9030-6E2B76781E0F}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -696,6 +700,30 @@ Global
{E30CF10F-FABF-4917-8BEB-CB81E4CE2C92}.Release|x64.Build.0 = Release|Any CPU
{E30CF10F-FABF-4917-8BEB-CB81E4CE2C92}.Release|x86.ActiveCfg = Release|Any CPU
{E30CF10F-FABF-4917-8BEB-CB81E4CE2C92}.Release|x86.Build.0 = Release|Any CPU
{2FD1634B-E0ED-4E68-A993-57AAEF2B9474}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2FD1634B-E0ED-4E68-A993-57AAEF2B9474}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2FD1634B-E0ED-4E68-A993-57AAEF2B9474}.Debug|x64.ActiveCfg = Debug|Any CPU
{2FD1634B-E0ED-4E68-A993-57AAEF2B9474}.Debug|x64.Build.0 = Debug|Any CPU
{2FD1634B-E0ED-4E68-A993-57AAEF2B9474}.Debug|x86.ActiveCfg = Debug|Any CPU
{2FD1634B-E0ED-4E68-A993-57AAEF2B9474}.Debug|x86.Build.0 = Debug|Any CPU
{2FD1634B-E0ED-4E68-A993-57AAEF2B9474}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2FD1634B-E0ED-4E68-A993-57AAEF2B9474}.Release|Any CPU.Build.0 = Release|Any CPU
{2FD1634B-E0ED-4E68-A993-57AAEF2B9474}.Release|x64.ActiveCfg = Release|Any CPU
{2FD1634B-E0ED-4E68-A993-57AAEF2B9474}.Release|x64.Build.0 = Release|Any CPU
{2FD1634B-E0ED-4E68-A993-57AAEF2B9474}.Release|x86.ActiveCfg = Release|Any CPU
{2FD1634B-E0ED-4E68-A993-57AAEF2B9474}.Release|x86.Build.0 = Release|Any CPU
{61985132-75C9-4601-9030-6E2B76781E0F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{61985132-75C9-4601-9030-6E2B76781E0F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{61985132-75C9-4601-9030-6E2B76781E0F}.Debug|x64.ActiveCfg = Debug|Any CPU
{61985132-75C9-4601-9030-6E2B76781E0F}.Debug|x64.Build.0 = Debug|Any CPU
{61985132-75C9-4601-9030-6E2B76781E0F}.Debug|x86.ActiveCfg = Debug|Any CPU
{61985132-75C9-4601-9030-6E2B76781E0F}.Debug|x86.Build.0 = Debug|Any CPU
{61985132-75C9-4601-9030-6E2B76781E0F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{61985132-75C9-4601-9030-6E2B76781E0F}.Release|Any CPU.Build.0 = Release|Any CPU
{61985132-75C9-4601-9030-6E2B76781E0F}.Release|x64.ActiveCfg = Release|Any CPU
{61985132-75C9-4601-9030-6E2B76781E0F}.Release|x64.Build.0 = Release|Any CPU
{61985132-75C9-4601-9030-6E2B76781E0F}.Release|x86.ActiveCfg = Release|Any CPU
{61985132-75C9-4601-9030-6E2B76781E0F}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down Expand Up @@ -750,6 +778,8 @@ Global
{1A8B6FA0-8341-4D27-9B71-57F70AB37571} = {0A27C140-4CCB-40DD-BE48-F5DE16D1177B}
{14586564-62CC-4117-AC1B-858ED53C2D6C} = {7EFA2FA7-32DD-4047-B021-50E77A83D714}
{E30CF10F-FABF-4917-8BEB-CB81E4CE2C92} = {7EFA2FA7-32DD-4047-B021-50E77A83D714}
{2FD1634B-E0ED-4E68-A993-57AAEF2B9474} = {C9BFDDC4-5671-47A3-B57D-197C2A51FA8A}
{61985132-75C9-4601-9030-6E2B76781E0F} = {C9BFDDC4-5671-47A3-B57D-197C2A51FA8A}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {B9D0D8F0-1AB9-44DD-839F-ED8CEE7DDB10}
Expand Down
1 change: 1 addition & 0 deletions src/Modules/SimplCommerce.Module.Core/ModuleInitializer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ public void ConfigureServices(IServiceCollection serviceCollection)

public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
// Method intentionally left empty.
}
}
}
22 changes: 22 additions & 0 deletions src/SimplCommerce.Db.MsSql/DependencyInjection.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
using Microsoft.AspNetCore.Builder;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using SimplCommerce.Module.Core.Data;
using SimplCommerce.Module.Core.Extensions;

namespace SimplCommerce.Db.MsSql
{
public static class DependencyInjection
{
public static IServiceCollection AddDbConfiguration(this IServiceCollection services, string connectionString)
{
services.AddDbContextPool<SimplDbContext>(options =>
options.UseSqlServer(connectionString,
x => x.MigrationsAssembly(
typeof(DependencyInjection).Assembly.FullName)
));
return services;
}
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;

namespace SimplCommerce.WebHost.Migrations
namespace SimplCommerce.Db.MsSql.Migrations
{
public partial class SimplCommerce_v1_0_0 : Migration
{
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using Microsoft.EntityFrameworkCore.Migrations;

namespace SimplCommerce.WebHost.Migrations
namespace SimplCommerce.Db.MsSql.Migrations
{
public partial class AddedCartLockOnCheckout : Migration
{
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using Microsoft.EntityFrameworkCore.Migrations;

namespace SimplCommerce.WebHost.Migrations
namespace SimplCommerce.Db.MsSql.Migrations
{
public partial class MomoPayment : Migration
{
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using Microsoft.EntityFrameworkCore.Migrations;

namespace SimplCommerce.WebHost.Migrations
namespace SimplCommerce.Db.MsSql.Migrations
{
public partial class AddedNganLuongPayment : Migration
{
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using Microsoft.EntityFrameworkCore.Migrations;

namespace SimplCommerce.WebHost.Migrations
namespace SimplCommerce.Db.MsSql.Migrations
{
public partial class DefaultCultureConfiguration : Migration
{
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using Microsoft.EntityFrameworkCore.Migrations;

namespace SimplCommerce.WebHost.Migrations
namespace SimplCommerce.Db.MsSql.Migrations
{
public partial class AddedCurrencySetting : Migration
{
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;

namespace SimplCommerce.WebHost.Migrations
namespace SimplCommerce.Db.MsSql.Migrations
{
public partial class AddedContentLocalization : Migration
{
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using Microsoft.EntityFrameworkCore.Migrations;

namespace SimplCommerce.WebHost.Migrations
namespace SimplCommerce.Db.MsSql.Migrations
{
public partial class AddedCashfreePayment : Migration
{
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using Microsoft.EntityFrameworkCore.Migrations;

namespace SimplCommerce.WebHost.Migrations
namespace SimplCommerce.Db.MsSql.Migrations
{
public partial class AddedAssetBundlingConfig : Migration
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using SimplCommerce.Module.Core.Data;

namespace SimplCommerce.WebHost.Migrations
namespace SimplCommerce.Db.MsSql.Migrations
{
[DbContext(typeof(SimplDbContext))]
partial class SimplDbContextModelSnapshot : ModelSnapshot
Expand Down
21 changes: 21 additions & 0 deletions src/SimplCommerce.Db.MsSql/SimplCommerce.Db.MsSql.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="6.0.4" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="6.0.4" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="6.0.4">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="6.0.4" />

</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Modules\SimplCommerce.Module.Core\SimplCommerce.Module.Core.csproj" />
</ItemGroup>
</Project>
22 changes: 22 additions & 0 deletions src/SimplCommerce.Db.PgSql/DependencyInjection.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
using Microsoft.AspNetCore.Builder;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using SimplCommerce.Module.Core.Data;
using SimplCommerce.Module.Core.Extensions;

namespace SimplCommerce.Db.PgSql
{
public static class DependencyInjection
{
public static IServiceCollection AddDbConfiguration(this IServiceCollection services, string connectionString)
{
services.AddDbContextPool<SimplDbContext>(options =>
options.UseNpgsql(connectionString,
x => x.MigrationsAssembly(
typeof(DependencyInjection).Assembly.FullName)
));
return services;
}
}
}
Loading