From f1da2241e928d64f2175dcab343175940849f756 Mon Sep 17 00:00:00 2001 From: Halil ibrahim Kalkan Date: Tue, 24 Jul 2018 10:23:13 +0300 Subject: [PATCH] #372 Added empty background jobs module. --- .../Volo.Abp.BackgroundJobs.sln | 90 +++++++++++++++++++ .../Program.cs | 12 +++ .../Volo.Abp.BackgroundJobs.DemoApp.csproj | 12 +++ ...lo.Abp.BackgroundJobs.Domain.Shared.csproj | 14 +++ .../BackgroundJobsDomainSharedModule.cs | 13 +++ .../Volo.Abp.BackgroundJobs.Domain.csproj | 15 ++++ .../BackgroundJobs/BackgroundJobsConsts.cs | 9 ++ .../BackgroundJobsDomainModule.cs | 16 ++++ ....BackgroundJobs.EntityFrameworkCore.csproj | 16 ++++ .../BackgroundJobsDbContext.cs | 35 ++++++++ ...undJobsDbContextModelCreatingExtensions.cs | 38 ++++++++ ...BackgroundJobsEntityFrameworkCoreModule.cs | 25 ++++++ ...undJobsModelBuilderConfigurationOptions.cs | 18 ++++ .../IBackgroundJobsDbContext.cs | 13 +++ .../Volo.Abp.BackgroundJobs.MongoDB.csproj | 15 ++++ .../AbpUsersMongoDbContextExtensions.cs | 20 +++++ .../MongoDB/BackgroundJobsBsonClassMap.cs | 21 +++++ .../MongoDB/BackgroundJobsMongoDbContext.cs | 25 ++++++ .../MongoDB/BackgroundJobsMongoDbModule.cs | 27 ++++++ ...bsMongoModelBuilderConfigurationOptions.cs | 14 +++ .../MongoDB/IBackgroundJobsMongoDbContext.cs | 13 +++ ...olo.Abp.BackgroundJobs.Domain.Tests.csproj | 18 ++++ .../BackgroundJobsDomainTestBase.cs | 7 ++ .../BackgroundJobsDomainTestModule.cs | 17 ++++ ...roundJobs.EntityFrameworkCore.Tests.csproj | 22 +++++ ...groundJobsEntityFrameworkCoreTestModule.cs | 44 +++++++++ .../MyEntityRepository_Tests.cs | 7 ++ ...lo.Abp.BackgroundJobs.MongoDB.Tests.csproj | 20 +++++ .../BackgroundJobsMongoDbTestModule.cs | 34 +++++++ .../MongoDB/MyEntityRepository_Tests.cs | 7 ++ .../Volo.Abp.BackgroundJobs.TestBase.csproj | 25 ++++++ .../BackgroundJobs/BackgroundJobsTestBase.cs | 14 +++ .../BackgroundJobsTestBaseModule.cs | 34 +++++++ .../BackgroundJobs/BackgroundJobsTestData.cs | 8 ++ .../BackgroundJobsTestDataBuilder.cs | 24 +++++ .../MyEntityRepository_Tests.cs | 16 ++++ 36 files changed, 758 insertions(+) create mode 100644 modules/background-jobs/Volo.Abp.BackgroundJobs.sln create mode 100644 modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp/Program.cs create mode 100644 modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp/Volo.Abp.BackgroundJobs.DemoApp.csproj create mode 100644 modules/background-jobs/src/Volo.Abp.BackgroundJobs.Domain.Shared/Volo.Abp.BackgroundJobs.Domain.Shared.csproj create mode 100644 modules/background-jobs/src/Volo.Abp.BackgroundJobs.Domain.Shared/Volo.Abp/BackgroundJobs/BackgroundJobsDomainSharedModule.cs create mode 100644 modules/background-jobs/src/Volo.Abp.BackgroundJobs.Domain/Volo.Abp.BackgroundJobs.Domain.csproj create mode 100644 modules/background-jobs/src/Volo.Abp.BackgroundJobs.Domain/Volo.Abp/BackgroundJobs/BackgroundJobsConsts.cs create mode 100644 modules/background-jobs/src/Volo.Abp.BackgroundJobs.Domain/Volo.Abp/BackgroundJobs/BackgroundJobsDomainModule.cs create mode 100644 modules/background-jobs/src/Volo.Abp.BackgroundJobs.EntityFrameworkCore/Volo.Abp.BackgroundJobs.EntityFrameworkCore.csproj create mode 100644 modules/background-jobs/src/Volo.Abp.BackgroundJobs.EntityFrameworkCore/Volo.Abp/BackgroundJobs/EntityFrameworkCore/BackgroundJobsDbContext.cs create mode 100644 modules/background-jobs/src/Volo.Abp.BackgroundJobs.EntityFrameworkCore/Volo.Abp/BackgroundJobs/EntityFrameworkCore/BackgroundJobsDbContextModelCreatingExtensions.cs create mode 100644 modules/background-jobs/src/Volo.Abp.BackgroundJobs.EntityFrameworkCore/Volo.Abp/BackgroundJobs/EntityFrameworkCore/BackgroundJobsEntityFrameworkCoreModule.cs create mode 100644 modules/background-jobs/src/Volo.Abp.BackgroundJobs.EntityFrameworkCore/Volo.Abp/BackgroundJobs/EntityFrameworkCore/BackgroundJobsModelBuilderConfigurationOptions.cs create mode 100644 modules/background-jobs/src/Volo.Abp.BackgroundJobs.EntityFrameworkCore/Volo.Abp/BackgroundJobs/EntityFrameworkCore/IBackgroundJobsDbContext.cs create mode 100644 modules/background-jobs/src/Volo.Abp.BackgroundJobs.MongoDB/Volo.Abp.BackgroundJobs.MongoDB.csproj create mode 100644 modules/background-jobs/src/Volo.Abp.BackgroundJobs.MongoDB/Volo.Abp/BackgroundJobs/MongoDB/AbpUsersMongoDbContextExtensions.cs create mode 100644 modules/background-jobs/src/Volo.Abp.BackgroundJobs.MongoDB/Volo.Abp/BackgroundJobs/MongoDB/BackgroundJobsBsonClassMap.cs create mode 100644 modules/background-jobs/src/Volo.Abp.BackgroundJobs.MongoDB/Volo.Abp/BackgroundJobs/MongoDB/BackgroundJobsMongoDbContext.cs create mode 100644 modules/background-jobs/src/Volo.Abp.BackgroundJobs.MongoDB/Volo.Abp/BackgroundJobs/MongoDB/BackgroundJobsMongoDbModule.cs create mode 100644 modules/background-jobs/src/Volo.Abp.BackgroundJobs.MongoDB/Volo.Abp/BackgroundJobs/MongoDB/BackgroundJobsMongoModelBuilderConfigurationOptions.cs create mode 100644 modules/background-jobs/src/Volo.Abp.BackgroundJobs.MongoDB/Volo.Abp/BackgroundJobs/MongoDB/IBackgroundJobsMongoDbContext.cs create mode 100644 modules/background-jobs/test/Volo.Abp.BackgroundJobs.Domain.Tests/Volo.Abp.BackgroundJobs.Domain.Tests.csproj create mode 100644 modules/background-jobs/test/Volo.Abp.BackgroundJobs.Domain.Tests/Volo.Abp/BackgroundJobs/BackgroundJobsDomainTestBase.cs create mode 100644 modules/background-jobs/test/Volo.Abp.BackgroundJobs.Domain.Tests/Volo.Abp/BackgroundJobs/BackgroundJobsDomainTestModule.cs create mode 100644 modules/background-jobs/test/Volo.Abp.BackgroundJobs.EntityFrameworkCore.Tests/Volo.Abp.BackgroundJobs.EntityFrameworkCore.Tests.csproj create mode 100644 modules/background-jobs/test/Volo.Abp.BackgroundJobs.EntityFrameworkCore.Tests/Volo.Abp/BackgroundJobs/EntityFrameworkCore/BackgroundJobsEntityFrameworkCoreTestModule.cs create mode 100644 modules/background-jobs/test/Volo.Abp.BackgroundJobs.EntityFrameworkCore.Tests/Volo.Abp/BackgroundJobs/EntityFrameworkCore/MyEntityRepository_Tests.cs create mode 100644 modules/background-jobs/test/Volo.Abp.BackgroundJobs.MongoDB.Tests/Volo.Abp.BackgroundJobs.MongoDB.Tests.csproj create mode 100644 modules/background-jobs/test/Volo.Abp.BackgroundJobs.MongoDB.Tests/Volo.Abp/BackgroundJobs/MongoDB/BackgroundJobsMongoDbTestModule.cs create mode 100644 modules/background-jobs/test/Volo.Abp.BackgroundJobs.MongoDB.Tests/Volo.Abp/BackgroundJobs/MongoDB/MyEntityRepository_Tests.cs create mode 100644 modules/background-jobs/test/Volo.Abp.BackgroundJobs.TestBase/Volo.Abp.BackgroundJobs.TestBase.csproj create mode 100644 modules/background-jobs/test/Volo.Abp.BackgroundJobs.TestBase/Volo.Abp/BackgroundJobs/BackgroundJobsTestBase.cs create mode 100644 modules/background-jobs/test/Volo.Abp.BackgroundJobs.TestBase/Volo.Abp/BackgroundJobs/BackgroundJobsTestBaseModule.cs create mode 100644 modules/background-jobs/test/Volo.Abp.BackgroundJobs.TestBase/Volo.Abp/BackgroundJobs/BackgroundJobsTestData.cs create mode 100644 modules/background-jobs/test/Volo.Abp.BackgroundJobs.TestBase/Volo.Abp/BackgroundJobs/BackgroundJobsTestDataBuilder.cs create mode 100644 modules/background-jobs/test/Volo.Abp.BackgroundJobs.TestBase/Volo.Abp/BackgroundJobs/MyEntityRepository_Tests.cs diff --git a/modules/background-jobs/Volo.Abp.BackgroundJobs.sln b/modules/background-jobs/Volo.Abp.BackgroundJobs.sln new file mode 100644 index 0000000000..50872d8025 --- /dev/null +++ b/modules/background-jobs/Volo.Abp.BackgroundJobs.sln @@ -0,0 +1,90 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.27703.2026 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Volo.Abp.BackgroundJobs.Domain.Shared", "src\Volo.Abp.BackgroundJobs.Domain.Shared\Volo.Abp.BackgroundJobs.Domain.Shared.csproj", "{D64C1577-4929-4B60-939E-96DE1534891A}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Volo.Abp.BackgroundJobs.Domain", "src\Volo.Abp.BackgroundJobs.Domain\Volo.Abp.BackgroundJobs.Domain.csproj", "{F2840BC7-0188-4606-9126-DADD0F5ABF7A}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{649A3FFA-182F-4E56-9717-E6A9A2BEC545}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{CCD2960C-23CC-4AB4-B84D-60C7AAA52F4D}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "app", "app", "{E400416D-2895-4512-9D17-90681EEC7E0A}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Volo.Abp.BackgroundJobs.EntityFrameworkCore", "src\Volo.Abp.BackgroundJobs.EntityFrameworkCore\Volo.Abp.BackgroundJobs.EntityFrameworkCore.csproj", "{0CE86223-D31D-4315-A1F5-87BA3EE1B844}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Volo.Abp.BackgroundJobs.MongoDB", "src\Volo.Abp.BackgroundJobs.MongoDB\Volo.Abp.BackgroundJobs.MongoDB.csproj", "{F1C58097-4C08-4D88-8976-6B3389391481}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Volo.Abp.BackgroundJobs.TestBase", "test\Volo.Abp.BackgroundJobs.TestBase\Volo.Abp.BackgroundJobs.TestBase.csproj", "{6E5B22E7-E2DB-45D4-B828-8019D8FD51E8}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Volo.Abp.BackgroundJobs.Domain.Tests", "test\Volo.Abp.BackgroundJobs.Domain.Tests\Volo.Abp.BackgroundJobs.Domain.Tests.csproj", "{44FB6636-5427-415D-8883-CB7E42D548F2}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Volo.Abp.BackgroundJobs.EntityFrameworkCore.Tests", "test\Volo.Abp.BackgroundJobs.EntityFrameworkCore.Tests\Volo.Abp.BackgroundJobs.EntityFrameworkCore.Tests.csproj", "{E5906DE1-B2F5-472E-BE1B-1D96A68B834D}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Volo.Abp.BackgroundJobs.MongoDB.Tests", "test\Volo.Abp.BackgroundJobs.MongoDB.Tests\Volo.Abp.BackgroundJobs.MongoDB.Tests.csproj", "{AA783A34-86E4-41A5-AE21-5D9FBD98D858}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Volo.Abp.BackgroundJobs.DemoApp", "app\Volo.Abp.BackgroundJobs.DemoApp\Volo.Abp.BackgroundJobs.DemoApp.csproj", "{9A871D66-BE8D-440C-BF79-F778F8A50BF3}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {D64C1577-4929-4B60-939E-96DE1534891A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D64C1577-4929-4B60-939E-96DE1534891A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D64C1577-4929-4B60-939E-96DE1534891A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D64C1577-4929-4B60-939E-96DE1534891A}.Release|Any CPU.Build.0 = Release|Any CPU + {F2840BC7-0188-4606-9126-DADD0F5ABF7A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F2840BC7-0188-4606-9126-DADD0F5ABF7A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F2840BC7-0188-4606-9126-DADD0F5ABF7A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F2840BC7-0188-4606-9126-DADD0F5ABF7A}.Release|Any CPU.Build.0 = Release|Any CPU + {0CE86223-D31D-4315-A1F5-87BA3EE1B844}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {0CE86223-D31D-4315-A1F5-87BA3EE1B844}.Debug|Any CPU.Build.0 = Debug|Any CPU + {0CE86223-D31D-4315-A1F5-87BA3EE1B844}.Release|Any CPU.ActiveCfg = Release|Any CPU + {0CE86223-D31D-4315-A1F5-87BA3EE1B844}.Release|Any CPU.Build.0 = Release|Any CPU + {F1C58097-4C08-4D88-8976-6B3389391481}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F1C58097-4C08-4D88-8976-6B3389391481}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F1C58097-4C08-4D88-8976-6B3389391481}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F1C58097-4C08-4D88-8976-6B3389391481}.Release|Any CPU.Build.0 = Release|Any CPU + {6E5B22E7-E2DB-45D4-B828-8019D8FD51E8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {6E5B22E7-E2DB-45D4-B828-8019D8FD51E8}.Debug|Any CPU.Build.0 = Debug|Any CPU + {6E5B22E7-E2DB-45D4-B828-8019D8FD51E8}.Release|Any CPU.ActiveCfg = Release|Any CPU + {6E5B22E7-E2DB-45D4-B828-8019D8FD51E8}.Release|Any CPU.Build.0 = Release|Any CPU + {44FB6636-5427-415D-8883-CB7E42D548F2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {44FB6636-5427-415D-8883-CB7E42D548F2}.Debug|Any CPU.Build.0 = Debug|Any CPU + {44FB6636-5427-415D-8883-CB7E42D548F2}.Release|Any CPU.ActiveCfg = Release|Any CPU + {44FB6636-5427-415D-8883-CB7E42D548F2}.Release|Any CPU.Build.0 = Release|Any CPU + {E5906DE1-B2F5-472E-BE1B-1D96A68B834D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E5906DE1-B2F5-472E-BE1B-1D96A68B834D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E5906DE1-B2F5-472E-BE1B-1D96A68B834D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E5906DE1-B2F5-472E-BE1B-1D96A68B834D}.Release|Any CPU.Build.0 = Release|Any CPU + {AA783A34-86E4-41A5-AE21-5D9FBD98D858}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {AA783A34-86E4-41A5-AE21-5D9FBD98D858}.Debug|Any CPU.Build.0 = Debug|Any CPU + {AA783A34-86E4-41A5-AE21-5D9FBD98D858}.Release|Any CPU.ActiveCfg = Release|Any CPU + {AA783A34-86E4-41A5-AE21-5D9FBD98D858}.Release|Any CPU.Build.0 = Release|Any CPU + {9A871D66-BE8D-440C-BF79-F778F8A50BF3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {9A871D66-BE8D-440C-BF79-F778F8A50BF3}.Debug|Any CPU.Build.0 = Debug|Any CPU + {9A871D66-BE8D-440C-BF79-F778F8A50BF3}.Release|Any CPU.ActiveCfg = Release|Any CPU + {9A871D66-BE8D-440C-BF79-F778F8A50BF3}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(NestedProjects) = preSolution + {D64C1577-4929-4B60-939E-96DE1534891A} = {649A3FFA-182F-4E56-9717-E6A9A2BEC545} + {F2840BC7-0188-4606-9126-DADD0F5ABF7A} = {649A3FFA-182F-4E56-9717-E6A9A2BEC545} + {0CE86223-D31D-4315-A1F5-87BA3EE1B844} = {649A3FFA-182F-4E56-9717-E6A9A2BEC545} + {F1C58097-4C08-4D88-8976-6B3389391481} = {649A3FFA-182F-4E56-9717-E6A9A2BEC545} + {6E5B22E7-E2DB-45D4-B828-8019D8FD51E8} = {CCD2960C-23CC-4AB4-B84D-60C7AAA52F4D} + {44FB6636-5427-415D-8883-CB7E42D548F2} = {CCD2960C-23CC-4AB4-B84D-60C7AAA52F4D} + {E5906DE1-B2F5-472E-BE1B-1D96A68B834D} = {CCD2960C-23CC-4AB4-B84D-60C7AAA52F4D} + {AA783A34-86E4-41A5-AE21-5D9FBD98D858} = {CCD2960C-23CC-4AB4-B84D-60C7AAA52F4D} + {9A871D66-BE8D-440C-BF79-F778F8A50BF3} = {E400416D-2895-4512-9D17-90681EEC7E0A} + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {4324B3B4-B60B-4E3C-91D8-59576B4E26DD} + EndGlobalSection +EndGlobal diff --git a/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp/Program.cs b/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp/Program.cs new file mode 100644 index 0000000000..41b8c36670 --- /dev/null +++ b/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp/Program.cs @@ -0,0 +1,12 @@ +using System; + +namespace Volo.Abp.BackgroundJobs.DemoApp +{ + class Program + { + static void Main(string[] args) + { + Console.WriteLine("Hello World!"); + } + } +} diff --git a/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp/Volo.Abp.BackgroundJobs.DemoApp.csproj b/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp/Volo.Abp.BackgroundJobs.DemoApp.csproj new file mode 100644 index 0000000000..a1579731b3 --- /dev/null +++ b/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp/Volo.Abp.BackgroundJobs.DemoApp.csproj @@ -0,0 +1,12 @@ + + + + Exe + netcoreapp2.1 + + + + + + + diff --git a/modules/background-jobs/src/Volo.Abp.BackgroundJobs.Domain.Shared/Volo.Abp.BackgroundJobs.Domain.Shared.csproj b/modules/background-jobs/src/Volo.Abp.BackgroundJobs.Domain.Shared/Volo.Abp.BackgroundJobs.Domain.Shared.csproj new file mode 100644 index 0000000000..e7334e2348 --- /dev/null +++ b/modules/background-jobs/src/Volo.Abp.BackgroundJobs.Domain.Shared/Volo.Abp.BackgroundJobs.Domain.Shared.csproj @@ -0,0 +1,14 @@ + + + + + + netstandard2.0 + + + + + + + + diff --git a/modules/background-jobs/src/Volo.Abp.BackgroundJobs.Domain.Shared/Volo.Abp/BackgroundJobs/BackgroundJobsDomainSharedModule.cs b/modules/background-jobs/src/Volo.Abp.BackgroundJobs.Domain.Shared/Volo.Abp/BackgroundJobs/BackgroundJobsDomainSharedModule.cs new file mode 100644 index 0000000000..ee2d85ab04 --- /dev/null +++ b/modules/background-jobs/src/Volo.Abp.BackgroundJobs.Domain.Shared/Volo.Abp/BackgroundJobs/BackgroundJobsDomainSharedModule.cs @@ -0,0 +1,13 @@ +using Microsoft.Extensions.DependencyInjection; +using Volo.Abp.Modularity; + +namespace Volo.Abp.BackgroundJobs +{ + public class BackgroundJobsDomainSharedModule : AbpModule + { + public override void ConfigureServices(ServiceConfigurationContext context) + { + context.Services.AddAssemblyOf(); + } + } +} diff --git a/modules/background-jobs/src/Volo.Abp.BackgroundJobs.Domain/Volo.Abp.BackgroundJobs.Domain.csproj b/modules/background-jobs/src/Volo.Abp.BackgroundJobs.Domain/Volo.Abp.BackgroundJobs.Domain.csproj new file mode 100644 index 0000000000..ddac542c72 --- /dev/null +++ b/modules/background-jobs/src/Volo.Abp.BackgroundJobs.Domain/Volo.Abp.BackgroundJobs.Domain.csproj @@ -0,0 +1,15 @@ + + + + + + netstandard2.0 + + + + + + + + + diff --git a/modules/background-jobs/src/Volo.Abp.BackgroundJobs.Domain/Volo.Abp/BackgroundJobs/BackgroundJobsConsts.cs b/modules/background-jobs/src/Volo.Abp.BackgroundJobs.Domain/Volo.Abp/BackgroundJobs/BackgroundJobsConsts.cs new file mode 100644 index 0000000000..66c2f4e95b --- /dev/null +++ b/modules/background-jobs/src/Volo.Abp.BackgroundJobs.Domain/Volo.Abp/BackgroundJobs/BackgroundJobsConsts.cs @@ -0,0 +1,9 @@ +namespace Volo.Abp.BackgroundJobs +{ + public static class BackgroundJobsConsts + { + public const string DefaultDbTablePrefix = "BackgroundJobs"; + + public const string DefaultDbSchema = null; + } +} diff --git a/modules/background-jobs/src/Volo.Abp.BackgroundJobs.Domain/Volo.Abp/BackgroundJobs/BackgroundJobsDomainModule.cs b/modules/background-jobs/src/Volo.Abp.BackgroundJobs.Domain/Volo.Abp/BackgroundJobs/BackgroundJobsDomainModule.cs new file mode 100644 index 0000000000..03bd1ec01d --- /dev/null +++ b/modules/background-jobs/src/Volo.Abp.BackgroundJobs.Domain/Volo.Abp/BackgroundJobs/BackgroundJobsDomainModule.cs @@ -0,0 +1,16 @@ +using Microsoft.Extensions.DependencyInjection; +using Volo.Abp.Modularity; + +namespace Volo.Abp.BackgroundJobs +{ + [DependsOn( + typeof(BackgroundJobsDomainSharedModule) + )] + public class BackgroundJobsDomainModule : AbpModule + { + public override void ConfigureServices(ServiceConfigurationContext context) + { + context.Services.AddAssemblyOf(); + } + } +} diff --git a/modules/background-jobs/src/Volo.Abp.BackgroundJobs.EntityFrameworkCore/Volo.Abp.BackgroundJobs.EntityFrameworkCore.csproj b/modules/background-jobs/src/Volo.Abp.BackgroundJobs.EntityFrameworkCore/Volo.Abp.BackgroundJobs.EntityFrameworkCore.csproj new file mode 100644 index 0000000000..cccae2dbd2 --- /dev/null +++ b/modules/background-jobs/src/Volo.Abp.BackgroundJobs.EntityFrameworkCore/Volo.Abp.BackgroundJobs.EntityFrameworkCore.csproj @@ -0,0 +1,16 @@ + + + + + + netstandard2.0 + + + + + + + + + + diff --git a/modules/background-jobs/src/Volo.Abp.BackgroundJobs.EntityFrameworkCore/Volo.Abp/BackgroundJobs/EntityFrameworkCore/BackgroundJobsDbContext.cs b/modules/background-jobs/src/Volo.Abp.BackgroundJobs.EntityFrameworkCore/Volo.Abp/BackgroundJobs/EntityFrameworkCore/BackgroundJobsDbContext.cs new file mode 100644 index 0000000000..1fcda6b4e4 --- /dev/null +++ b/modules/background-jobs/src/Volo.Abp.BackgroundJobs.EntityFrameworkCore/Volo.Abp/BackgroundJobs/EntityFrameworkCore/BackgroundJobsDbContext.cs @@ -0,0 +1,35 @@ +using Microsoft.EntityFrameworkCore; +using Volo.Abp.Data; +using Volo.Abp.EntityFrameworkCore; + +namespace Volo.Abp.BackgroundJobs.EntityFrameworkCore +{ + [ConnectionStringName("BackgroundJobs")] + public class BackgroundJobsDbContext : AbpDbContext, IBackgroundJobsDbContext + { + public static string TablePrefix { get; set; } = BackgroundJobsConsts.DefaultDbTablePrefix; + + public static string Schema { get; set; } = BackgroundJobsConsts.DefaultDbSchema; + + /* Add DbSet for each Aggregate Root here. Example: + * public DbSet Questions { get; set; } + */ + + public BackgroundJobsDbContext(DbContextOptions options) + : base(options) + { + + } + + protected override void OnModelCreating(ModelBuilder builder) + { + base.OnModelCreating(builder); + + builder.ConfigureBackgroundJobs(options => + { + options.TablePrefix = TablePrefix; + options.Schema = Schema; + }); + } + } +} \ No newline at end of file diff --git a/modules/background-jobs/src/Volo.Abp.BackgroundJobs.EntityFrameworkCore/Volo.Abp/BackgroundJobs/EntityFrameworkCore/BackgroundJobsDbContextModelCreatingExtensions.cs b/modules/background-jobs/src/Volo.Abp.BackgroundJobs.EntityFrameworkCore/Volo.Abp/BackgroundJobs/EntityFrameworkCore/BackgroundJobsDbContextModelCreatingExtensions.cs new file mode 100644 index 0000000000..c1964d6fb9 --- /dev/null +++ b/modules/background-jobs/src/Volo.Abp.BackgroundJobs.EntityFrameworkCore/Volo.Abp/BackgroundJobs/EntityFrameworkCore/BackgroundJobsDbContextModelCreatingExtensions.cs @@ -0,0 +1,38 @@ +using System; +using Microsoft.EntityFrameworkCore; +using Volo.Abp; + +namespace Volo.Abp.BackgroundJobs.EntityFrameworkCore +{ + public static class BackgroundJobsDbContextModelCreatingExtensions + { + public static void ConfigureBackgroundJobs( + this ModelBuilder builder, + Action optionsAction = null) + { + Check.NotNull(builder, nameof(builder)); + + var options = new BackgroundJobsModelBuilderConfigurationOptions(); + + optionsAction?.Invoke(options); + + /* Configure all entities here. Example: + + builder.Entity(b => + { + //Configure table & schema name + //b.ToTable(options.TablePrefix + "Questions", options.Schema); + + //Properties + //b.Property(q => q.Title).IsRequired().HasMaxLength(QuestionConsts.MaxTitleLength); + + //Configure relations + //b.HasMany(question => question.Tags).WithOne().HasForeignKey(qt => qt.QuestionId); + + //Configure indexes + //b.HasIndex(q => q.CreationTime); + }); + */ + } + } +} \ No newline at end of file diff --git a/modules/background-jobs/src/Volo.Abp.BackgroundJobs.EntityFrameworkCore/Volo.Abp/BackgroundJobs/EntityFrameworkCore/BackgroundJobsEntityFrameworkCoreModule.cs b/modules/background-jobs/src/Volo.Abp.BackgroundJobs.EntityFrameworkCore/Volo.Abp/BackgroundJobs/EntityFrameworkCore/BackgroundJobsEntityFrameworkCoreModule.cs new file mode 100644 index 0000000000..972376d08f --- /dev/null +++ b/modules/background-jobs/src/Volo.Abp.BackgroundJobs.EntityFrameworkCore/Volo.Abp/BackgroundJobs/EntityFrameworkCore/BackgroundJobsEntityFrameworkCoreModule.cs @@ -0,0 +1,25 @@ +using Microsoft.Extensions.DependencyInjection; +using Volo.Abp.EntityFrameworkCore; +using Volo.Abp.Modularity; + +namespace Volo.Abp.BackgroundJobs.EntityFrameworkCore +{ + [DependsOn( + typeof(BackgroundJobsDomainModule), + typeof(AbpEntityFrameworkCoreModule) + )] + public class BackgroundJobsEntityFrameworkCoreModule : AbpModule + { + public override void ConfigureServices(ServiceConfigurationContext context) + { + context.Services.AddAbpDbContext(options => + { + /* Add custom repositories here. Example: + * options.AddRepository(); + */ + }); + + context.Services.AddAssemblyOf(); + } + } +} \ No newline at end of file diff --git a/modules/background-jobs/src/Volo.Abp.BackgroundJobs.EntityFrameworkCore/Volo.Abp/BackgroundJobs/EntityFrameworkCore/BackgroundJobsModelBuilderConfigurationOptions.cs b/modules/background-jobs/src/Volo.Abp.BackgroundJobs.EntityFrameworkCore/Volo.Abp/BackgroundJobs/EntityFrameworkCore/BackgroundJobsModelBuilderConfigurationOptions.cs new file mode 100644 index 0000000000..43cd847ea2 --- /dev/null +++ b/modules/background-jobs/src/Volo.Abp.BackgroundJobs.EntityFrameworkCore/Volo.Abp/BackgroundJobs/EntityFrameworkCore/BackgroundJobsModelBuilderConfigurationOptions.cs @@ -0,0 +1,18 @@ +using JetBrains.Annotations; +using Volo.Abp.EntityFrameworkCore.Modeling; + +namespace Volo.Abp.BackgroundJobs.EntityFrameworkCore +{ + public class BackgroundJobsModelBuilderConfigurationOptions : ModelBuilderConfigurationOptions + { + public BackgroundJobsModelBuilderConfigurationOptions( + [NotNull] string tablePrefix = BackgroundJobsConsts.DefaultDbTablePrefix, + [CanBeNull] string schema = BackgroundJobsConsts.DefaultDbSchema) + : base( + tablePrefix, + schema) + { + + } + } +} \ No newline at end of file diff --git a/modules/background-jobs/src/Volo.Abp.BackgroundJobs.EntityFrameworkCore/Volo.Abp/BackgroundJobs/EntityFrameworkCore/IBackgroundJobsDbContext.cs b/modules/background-jobs/src/Volo.Abp.BackgroundJobs.EntityFrameworkCore/Volo.Abp/BackgroundJobs/EntityFrameworkCore/IBackgroundJobsDbContext.cs new file mode 100644 index 0000000000..716bbad810 --- /dev/null +++ b/modules/background-jobs/src/Volo.Abp.BackgroundJobs.EntityFrameworkCore/Volo.Abp/BackgroundJobs/EntityFrameworkCore/IBackgroundJobsDbContext.cs @@ -0,0 +1,13 @@ +using Volo.Abp.Data; +using Volo.Abp.EntityFrameworkCore; + +namespace Volo.Abp.BackgroundJobs.EntityFrameworkCore +{ + [ConnectionStringName("BackgroundJobs")] + public interface IBackgroundJobsDbContext : IEfCoreDbContext + { + /* Add DbSet for each Aggregate Root here. Example: + * DbSet Questions { get; } + */ + } +} \ No newline at end of file diff --git a/modules/background-jobs/src/Volo.Abp.BackgroundJobs.MongoDB/Volo.Abp.BackgroundJobs.MongoDB.csproj b/modules/background-jobs/src/Volo.Abp.BackgroundJobs.MongoDB/Volo.Abp.BackgroundJobs.MongoDB.csproj new file mode 100644 index 0000000000..4b3184d0ab --- /dev/null +++ b/modules/background-jobs/src/Volo.Abp.BackgroundJobs.MongoDB/Volo.Abp.BackgroundJobs.MongoDB.csproj @@ -0,0 +1,15 @@ + + + + + + netstandard2.0 + + + + + + + + + diff --git a/modules/background-jobs/src/Volo.Abp.BackgroundJobs.MongoDB/Volo.Abp/BackgroundJobs/MongoDB/AbpUsersMongoDbContextExtensions.cs b/modules/background-jobs/src/Volo.Abp.BackgroundJobs.MongoDB/Volo.Abp/BackgroundJobs/MongoDB/AbpUsersMongoDbContextExtensions.cs new file mode 100644 index 0000000000..2487b0b9bb --- /dev/null +++ b/modules/background-jobs/src/Volo.Abp.BackgroundJobs.MongoDB/Volo.Abp/BackgroundJobs/MongoDB/AbpUsersMongoDbContextExtensions.cs @@ -0,0 +1,20 @@ +using System; +using Volo.Abp; +using Volo.Abp.MongoDB; + +namespace Volo.Abp.BackgroundJobs.MongoDB +{ + public static class AbpUsersMongoDbContextExtensions + { + public static void ConfigureBackgroundJobs( + this IMongoModelBuilder builder, + Action optionsAction = null) + { + Check.NotNull(builder, nameof(builder)); + + var options = new BackgroundJobsMongoModelBuilderConfigurationOptions(); + + optionsAction?.Invoke(options); + } + } +} \ No newline at end of file diff --git a/modules/background-jobs/src/Volo.Abp.BackgroundJobs.MongoDB/Volo.Abp/BackgroundJobs/MongoDB/BackgroundJobsBsonClassMap.cs b/modules/background-jobs/src/Volo.Abp.BackgroundJobs.MongoDB/Volo.Abp/BackgroundJobs/MongoDB/BackgroundJobsBsonClassMap.cs new file mode 100644 index 0000000000..32d8bec976 --- /dev/null +++ b/modules/background-jobs/src/Volo.Abp.BackgroundJobs.MongoDB/Volo.Abp/BackgroundJobs/MongoDB/BackgroundJobsBsonClassMap.cs @@ -0,0 +1,21 @@ +using Volo.Abp.Threading; + +namespace Volo.Abp.BackgroundJobs.MongoDB +{ + public static class BackgroundJobsBsonClassMap + { + private static readonly OneTimeRunner OneTimeRunner = new OneTimeRunner(); + + public static void Configure() + { + OneTimeRunner.Run(() => + { + //Register mappings here. Example: + //BsonClassMap.RegisterClassMap(map => + //{ + // map.AutoMap(); + //}); + }); + } + } +} \ No newline at end of file diff --git a/modules/background-jobs/src/Volo.Abp.BackgroundJobs.MongoDB/Volo.Abp/BackgroundJobs/MongoDB/BackgroundJobsMongoDbContext.cs b/modules/background-jobs/src/Volo.Abp.BackgroundJobs.MongoDB/Volo.Abp/BackgroundJobs/MongoDB/BackgroundJobsMongoDbContext.cs new file mode 100644 index 0000000000..1e40d9ba17 --- /dev/null +++ b/modules/background-jobs/src/Volo.Abp.BackgroundJobs.MongoDB/Volo.Abp/BackgroundJobs/MongoDB/BackgroundJobsMongoDbContext.cs @@ -0,0 +1,25 @@ +using Volo.Abp.Data; +using Volo.Abp.MongoDB; + +namespace Volo.Abp.BackgroundJobs.MongoDB +{ + [ConnectionStringName("BackgroundJobs")] + public class BackgroundJobsMongoDbContext : AbpMongoDbContext, IBackgroundJobsMongoDbContext + { + public static string CollectionPrefix { get; set; } = BackgroundJobsConsts.DefaultDbTablePrefix; + + /* Add mongo collections here. Example: + * public IMongoCollection Questions => Collection(); + */ + + protected override void CreateModel(IMongoModelBuilder modelBuilder) + { + base.CreateModel(modelBuilder); + + modelBuilder.ConfigureBackgroundJobs(options => + { + options.CollectionPrefix = CollectionPrefix; + }); + } + } +} \ No newline at end of file diff --git a/modules/background-jobs/src/Volo.Abp.BackgroundJobs.MongoDB/Volo.Abp/BackgroundJobs/MongoDB/BackgroundJobsMongoDbModule.cs b/modules/background-jobs/src/Volo.Abp.BackgroundJobs.MongoDB/Volo.Abp/BackgroundJobs/MongoDB/BackgroundJobsMongoDbModule.cs new file mode 100644 index 0000000000..6c034beb45 --- /dev/null +++ b/modules/background-jobs/src/Volo.Abp.BackgroundJobs.MongoDB/Volo.Abp/BackgroundJobs/MongoDB/BackgroundJobsMongoDbModule.cs @@ -0,0 +1,27 @@ +using Microsoft.Extensions.DependencyInjection; +using Volo.Abp.Modularity; +using Volo.Abp.MongoDB; + +namespace Volo.Abp.BackgroundJobs.MongoDB +{ + [DependsOn( + typeof(BackgroundJobsDomainModule), + typeof(AbpMongoDbModule) + )] + public class BackgroundJobsMongoDbModule : AbpModule + { + public override void ConfigureServices(ServiceConfigurationContext context) + { + BackgroundJobsBsonClassMap.Configure(); + + context.Services.AddMongoDbContext(options => + { + /* Add custom repositories here. Example: + * options.AddRepository(); + */ + }); + + context.Services.AddAssemblyOf(); + } + } +} diff --git a/modules/background-jobs/src/Volo.Abp.BackgroundJobs.MongoDB/Volo.Abp/BackgroundJobs/MongoDB/BackgroundJobsMongoModelBuilderConfigurationOptions.cs b/modules/background-jobs/src/Volo.Abp.BackgroundJobs.MongoDB/Volo.Abp/BackgroundJobs/MongoDB/BackgroundJobsMongoModelBuilderConfigurationOptions.cs new file mode 100644 index 0000000000..1dfa33ed69 --- /dev/null +++ b/modules/background-jobs/src/Volo.Abp.BackgroundJobs.MongoDB/Volo.Abp/BackgroundJobs/MongoDB/BackgroundJobsMongoModelBuilderConfigurationOptions.cs @@ -0,0 +1,14 @@ +using JetBrains.Annotations; +using Volo.Abp.MongoDB; + +namespace Volo.Abp.BackgroundJobs.MongoDB +{ + public class BackgroundJobsMongoModelBuilderConfigurationOptions : MongoModelBuilderConfigurationOptions + { + public BackgroundJobsMongoModelBuilderConfigurationOptions( + [NotNull] string tablePrefix = BackgroundJobsConsts.DefaultDbTablePrefix) + : base(tablePrefix) + { + } + } +} \ No newline at end of file diff --git a/modules/background-jobs/src/Volo.Abp.BackgroundJobs.MongoDB/Volo.Abp/BackgroundJobs/MongoDB/IBackgroundJobsMongoDbContext.cs b/modules/background-jobs/src/Volo.Abp.BackgroundJobs.MongoDB/Volo.Abp/BackgroundJobs/MongoDB/IBackgroundJobsMongoDbContext.cs new file mode 100644 index 0000000000..37d506b2b8 --- /dev/null +++ b/modules/background-jobs/src/Volo.Abp.BackgroundJobs.MongoDB/Volo.Abp/BackgroundJobs/MongoDB/IBackgroundJobsMongoDbContext.cs @@ -0,0 +1,13 @@ +using Volo.Abp.Data; +using Volo.Abp.MongoDB; + +namespace Volo.Abp.BackgroundJobs.MongoDB +{ + [ConnectionStringName("BackgroundJobs")] + public interface IBackgroundJobsMongoDbContext : IAbpMongoDbContext + { + /* Define mongo collections here. Example: + * IMongoCollection Questions { get; } + */ + } +} diff --git a/modules/background-jobs/test/Volo.Abp.BackgroundJobs.Domain.Tests/Volo.Abp.BackgroundJobs.Domain.Tests.csproj b/modules/background-jobs/test/Volo.Abp.BackgroundJobs.Domain.Tests/Volo.Abp.BackgroundJobs.Domain.Tests.csproj new file mode 100644 index 0000000000..b0cf04eb2a --- /dev/null +++ b/modules/background-jobs/test/Volo.Abp.BackgroundJobs.Domain.Tests/Volo.Abp.BackgroundJobs.Domain.Tests.csproj @@ -0,0 +1,18 @@ + + + + + + netcoreapp2.1 + + + + + + + + + + + + diff --git a/modules/background-jobs/test/Volo.Abp.BackgroundJobs.Domain.Tests/Volo.Abp/BackgroundJobs/BackgroundJobsDomainTestBase.cs b/modules/background-jobs/test/Volo.Abp.BackgroundJobs.Domain.Tests/Volo.Abp/BackgroundJobs/BackgroundJobsDomainTestBase.cs new file mode 100644 index 0000000000..259fbf1929 --- /dev/null +++ b/modules/background-jobs/test/Volo.Abp.BackgroundJobs.Domain.Tests/Volo.Abp/BackgroundJobs/BackgroundJobsDomainTestBase.cs @@ -0,0 +1,7 @@ +namespace Volo.Abp.BackgroundJobs +{ + public abstract class BackgroundJobsDomainTestBase : BackgroundJobsTestBase + { + + } +} \ No newline at end of file diff --git a/modules/background-jobs/test/Volo.Abp.BackgroundJobs.Domain.Tests/Volo.Abp/BackgroundJobs/BackgroundJobsDomainTestModule.cs b/modules/background-jobs/test/Volo.Abp.BackgroundJobs.Domain.Tests/Volo.Abp/BackgroundJobs/BackgroundJobsDomainTestModule.cs new file mode 100644 index 0000000000..c814ce6ee7 --- /dev/null +++ b/modules/background-jobs/test/Volo.Abp.BackgroundJobs.Domain.Tests/Volo.Abp/BackgroundJobs/BackgroundJobsDomainTestModule.cs @@ -0,0 +1,17 @@ +using Microsoft.Extensions.DependencyInjection; +using Volo.Abp.BackgroundJobs.EntityFrameworkCore; +using Volo.Abp.Modularity; + +namespace Volo.Abp.BackgroundJobs +{ + [DependsOn( + typeof(BackgroundJobsEntityFrameworkCoreTestModule) + )] + public class BackgroundJobsDomainTestModule : AbpModule + { + public override void ConfigureServices(ServiceConfigurationContext context) + { + context.Services.AddAssemblyOf(); + } + } +} diff --git a/modules/background-jobs/test/Volo.Abp.BackgroundJobs.EntityFrameworkCore.Tests/Volo.Abp.BackgroundJobs.EntityFrameworkCore.Tests.csproj b/modules/background-jobs/test/Volo.Abp.BackgroundJobs.EntityFrameworkCore.Tests/Volo.Abp.BackgroundJobs.EntityFrameworkCore.Tests.csproj new file mode 100644 index 0000000000..fd6737a30b --- /dev/null +++ b/modules/background-jobs/test/Volo.Abp.BackgroundJobs.EntityFrameworkCore.Tests/Volo.Abp.BackgroundJobs.EntityFrameworkCore.Tests.csproj @@ -0,0 +1,22 @@ + + + + + + netcoreapp2.1 + + + + + + + + + + + + + + + + diff --git a/modules/background-jobs/test/Volo.Abp.BackgroundJobs.EntityFrameworkCore.Tests/Volo.Abp/BackgroundJobs/EntityFrameworkCore/BackgroundJobsEntityFrameworkCoreTestModule.cs b/modules/background-jobs/test/Volo.Abp.BackgroundJobs.EntityFrameworkCore.Tests/Volo.Abp/BackgroundJobs/EntityFrameworkCore/BackgroundJobsEntityFrameworkCoreTestModule.cs new file mode 100644 index 0000000000..ad1a130805 --- /dev/null +++ b/modules/background-jobs/test/Volo.Abp.BackgroundJobs.EntityFrameworkCore.Tests/Volo.Abp/BackgroundJobs/EntityFrameworkCore/BackgroundJobsEntityFrameworkCoreTestModule.cs @@ -0,0 +1,44 @@ +using Microsoft.Data.Sqlite; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Storage; +using Microsoft.Extensions.DependencyInjection; +using Volo.Abp.EntityFrameworkCore; +using Volo.Abp.Modularity; + +namespace Volo.Abp.BackgroundJobs.EntityFrameworkCore +{ + [DependsOn( + typeof(BackgroundJobsTestBaseModule), + typeof(BackgroundJobsEntityFrameworkCoreModule) + )] + public class BackgroundJobsEntityFrameworkCoreTestModule : AbpModule + { + public override void ConfigureServices(ServiceConfigurationContext context) + { + var sqliteConnection = CreateDatabaseAndGetConnection(); + + context.Services.Configure(options => + { + options.Configure(abpDbContextConfigurationContext => + { + abpDbContextConfigurationContext.DbContextOptions.UseSqlite(sqliteConnection); + }); + }); + + context.Services.AddAssemblyOf(); + } + + private static SqliteConnection CreateDatabaseAndGetConnection() + { + var connection = new SqliteConnection("Data Source=:memory:"); + connection.Open(); + + new BackgroundJobsDbContext( + new DbContextOptionsBuilder().UseSqlite(connection).Options + ).GetService().CreateTables(); + + return connection; + } + } +} diff --git a/modules/background-jobs/test/Volo.Abp.BackgroundJobs.EntityFrameworkCore.Tests/Volo.Abp/BackgroundJobs/EntityFrameworkCore/MyEntityRepository_Tests.cs b/modules/background-jobs/test/Volo.Abp.BackgroundJobs.EntityFrameworkCore.Tests/Volo.Abp/BackgroundJobs/EntityFrameworkCore/MyEntityRepository_Tests.cs new file mode 100644 index 0000000000..9dde34370d --- /dev/null +++ b/modules/background-jobs/test/Volo.Abp.BackgroundJobs.EntityFrameworkCore.Tests/Volo.Abp/BackgroundJobs/EntityFrameworkCore/MyEntityRepository_Tests.cs @@ -0,0 +1,7 @@ +namespace Volo.Abp.BackgroundJobs.EntityFrameworkCore +{ + public class MyEntityRepository_Tests : MyEntityRepository_Tests + { + + } +} diff --git a/modules/background-jobs/test/Volo.Abp.BackgroundJobs.MongoDB.Tests/Volo.Abp.BackgroundJobs.MongoDB.Tests.csproj b/modules/background-jobs/test/Volo.Abp.BackgroundJobs.MongoDB.Tests/Volo.Abp.BackgroundJobs.MongoDB.Tests.csproj new file mode 100644 index 0000000000..45bc123378 --- /dev/null +++ b/modules/background-jobs/test/Volo.Abp.BackgroundJobs.MongoDB.Tests/Volo.Abp.BackgroundJobs.MongoDB.Tests.csproj @@ -0,0 +1,20 @@ + + + + + + netcoreapp2.1 + + + + + + + + + + + + + + diff --git a/modules/background-jobs/test/Volo.Abp.BackgroundJobs.MongoDB.Tests/Volo.Abp/BackgroundJobs/MongoDB/BackgroundJobsMongoDbTestModule.cs b/modules/background-jobs/test/Volo.Abp.BackgroundJobs.MongoDB.Tests/Volo.Abp/BackgroundJobs/MongoDB/BackgroundJobsMongoDbTestModule.cs new file mode 100644 index 0000000000..4a86bbc262 --- /dev/null +++ b/modules/background-jobs/test/Volo.Abp.BackgroundJobs.MongoDB.Tests/Volo.Abp/BackgroundJobs/MongoDB/BackgroundJobsMongoDbTestModule.cs @@ -0,0 +1,34 @@ +using Microsoft.Extensions.DependencyInjection; +using Mongo2Go; +using Volo.Abp; +using Volo.Abp.Data; +using Volo.Abp.Modularity; + +namespace Volo.Abp.BackgroundJobs.MongoDB +{ + [DependsOn( + typeof(BackgroundJobsTestBaseModule), + typeof(BackgroundJobsMongoDbModule) + )] + public class BackgroundJobsMongoDbTestModule : AbpModule + { + private MongoDbRunner _mongoDbRunner; + + public override void ConfigureServices(ServiceConfigurationContext context) + { + _mongoDbRunner = MongoDbRunner.Start(); + + context.Services.Configure(options => + { + options.ConnectionStrings.Default = _mongoDbRunner.ConnectionString; + }); + + context.Services.AddAssemblyOf(); + } + + public override void OnApplicationShutdown(ApplicationShutdownContext context) + { + _mongoDbRunner.Dispose(); + } + } +} \ No newline at end of file diff --git a/modules/background-jobs/test/Volo.Abp.BackgroundJobs.MongoDB.Tests/Volo.Abp/BackgroundJobs/MongoDB/MyEntityRepository_Tests.cs b/modules/background-jobs/test/Volo.Abp.BackgroundJobs.MongoDB.Tests/Volo.Abp/BackgroundJobs/MongoDB/MyEntityRepository_Tests.cs new file mode 100644 index 0000000000..c9d386c638 --- /dev/null +++ b/modules/background-jobs/test/Volo.Abp.BackgroundJobs.MongoDB.Tests/Volo.Abp/BackgroundJobs/MongoDB/MyEntityRepository_Tests.cs @@ -0,0 +1,7 @@ +namespace Volo.Abp.BackgroundJobs.MongoDB +{ + public class MyEntityRepository_Tests : MyEntityRepository_Tests + { + + } +} diff --git a/modules/background-jobs/test/Volo.Abp.BackgroundJobs.TestBase/Volo.Abp.BackgroundJobs.TestBase.csproj b/modules/background-jobs/test/Volo.Abp.BackgroundJobs.TestBase/Volo.Abp.BackgroundJobs.TestBase.csproj new file mode 100644 index 0000000000..c3676c769a --- /dev/null +++ b/modules/background-jobs/test/Volo.Abp.BackgroundJobs.TestBase/Volo.Abp.BackgroundJobs.TestBase.csproj @@ -0,0 +1,25 @@ + + + + + + netcoreapp2.1 + + + + + + + + + + + + + + + + + + + diff --git a/modules/background-jobs/test/Volo.Abp.BackgroundJobs.TestBase/Volo.Abp/BackgroundJobs/BackgroundJobsTestBase.cs b/modules/background-jobs/test/Volo.Abp.BackgroundJobs.TestBase/Volo.Abp/BackgroundJobs/BackgroundJobsTestBase.cs new file mode 100644 index 0000000000..ea7b932a79 --- /dev/null +++ b/modules/background-jobs/test/Volo.Abp.BackgroundJobs.TestBase/Volo.Abp/BackgroundJobs/BackgroundJobsTestBase.cs @@ -0,0 +1,14 @@ +using Volo.Abp; +using Volo.Abp.Modularity; + +namespace Volo.Abp.BackgroundJobs +{ + public abstract class BackgroundJobsTestBase : AbpIntegratedTest + where TStartupModule : IAbpModule + { + protected override void SetAbpApplicationCreationOptions(AbpApplicationCreationOptions options) + { + options.UseAutofac(); + } + } +} diff --git a/modules/background-jobs/test/Volo.Abp.BackgroundJobs.TestBase/Volo.Abp/BackgroundJobs/BackgroundJobsTestBaseModule.cs b/modules/background-jobs/test/Volo.Abp.BackgroundJobs.TestBase/Volo.Abp/BackgroundJobs/BackgroundJobsTestBaseModule.cs new file mode 100644 index 0000000000..d1f8145c39 --- /dev/null +++ b/modules/background-jobs/test/Volo.Abp.BackgroundJobs.TestBase/Volo.Abp/BackgroundJobs/BackgroundJobsTestBaseModule.cs @@ -0,0 +1,34 @@ +using Microsoft.Extensions.DependencyInjection; +using Volo.Abp.Autofac; +using Volo.Abp.Modularity; + +namespace Volo.Abp.BackgroundJobs +{ + [DependsOn( + typeof(AbpAutofacModule), + typeof(AbpTestBaseModule), + typeof(BackgroundJobsDomainModule) + )] + public class BackgroundJobsTestBaseModule : AbpModule + { + public override void ConfigureServices(ServiceConfigurationContext context) + { + context.Services.AddAssemblyOf(); + } + + public override void OnApplicationInitialization(ApplicationInitializationContext context) + { + SeedTestData(context); + } + + private static void SeedTestData(ApplicationInitializationContext context) + { + using (var scope = context.ServiceProvider.CreateScope()) + { + scope.ServiceProvider + .GetRequiredService() + .Build(); + } + } + } +} diff --git a/modules/background-jobs/test/Volo.Abp.BackgroundJobs.TestBase/Volo.Abp/BackgroundJobs/BackgroundJobsTestData.cs b/modules/background-jobs/test/Volo.Abp.BackgroundJobs.TestBase/Volo.Abp/BackgroundJobs/BackgroundJobsTestData.cs new file mode 100644 index 0000000000..5d46b25ca9 --- /dev/null +++ b/modules/background-jobs/test/Volo.Abp.BackgroundJobs.TestBase/Volo.Abp/BackgroundJobs/BackgroundJobsTestData.cs @@ -0,0 +1,8 @@ +using Volo.Abp.DependencyInjection; + +namespace Volo.Abp.BackgroundJobs +{ + public class BackgroundJobsTestData : ISingletonDependency + { + } +} diff --git a/modules/background-jobs/test/Volo.Abp.BackgroundJobs.TestBase/Volo.Abp/BackgroundJobs/BackgroundJobsTestDataBuilder.cs b/modules/background-jobs/test/Volo.Abp.BackgroundJobs.TestBase/Volo.Abp/BackgroundJobs/BackgroundJobsTestDataBuilder.cs new file mode 100644 index 0000000000..f9df05c4d7 --- /dev/null +++ b/modules/background-jobs/test/Volo.Abp.BackgroundJobs.TestBase/Volo.Abp/BackgroundJobs/BackgroundJobsTestDataBuilder.cs @@ -0,0 +1,24 @@ +using Volo.Abp.DependencyInjection; +using Volo.Abp.Guids; + +namespace Volo.Abp.BackgroundJobs +{ + public class BackgroundJobsTestDataBuilder : ITransientDependency + { + private readonly IGuidGenerator _guidGenerator; + private BackgroundJobsTestData _testData; + + public BackgroundJobsTestDataBuilder( + IGuidGenerator guidGenerator, + BackgroundJobsTestData testData) + { + _guidGenerator = guidGenerator; + _testData = testData; + } + + public void Build() + { + + } + } +} \ No newline at end of file diff --git a/modules/background-jobs/test/Volo.Abp.BackgroundJobs.TestBase/Volo.Abp/BackgroundJobs/MyEntityRepository_Tests.cs b/modules/background-jobs/test/Volo.Abp.BackgroundJobs.TestBase/Volo.Abp/BackgroundJobs/MyEntityRepository_Tests.cs new file mode 100644 index 0000000000..5053a64a62 --- /dev/null +++ b/modules/background-jobs/test/Volo.Abp.BackgroundJobs.TestBase/Volo.Abp/BackgroundJobs/MyEntityRepository_Tests.cs @@ -0,0 +1,16 @@ +using System.Threading.Tasks; +using Volo.Abp.Modularity; +using Xunit; + +namespace Volo.Abp.BackgroundJobs +{ + public abstract class MyEntityRepository_Tests : BackgroundJobsTestBase + where TStartupModule : IAbpModule + { + [Fact] + public async Task Test1() + { + + } + } +}