101 changed files with 2181 additions and 0 deletions
@ -0,0 +1,116 @@ |
|||
|
|||
Microsoft Visual Studio Solution File, Format Version 12.00 |
|||
# Visual Studio Version 17 |
|||
VisualStudioVersion = 17.0.31717.71 |
|||
MinimumVisualStudioVersion = 10.0.40219.1 |
|||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EShopOnAbp.OrderingService.Domain.Shared", "src\EShopOnAbp.OrderingService.Domain.Shared\EShopOnAbp.OrderingService.Domain.Shared.csproj", "{D64C1577-4929-4B60-939E-96DE1534891A}" |
|||
EndProject |
|||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EShopOnAbp.OrderingService.Domain", "src\EShopOnAbp.OrderingService.Domain\EShopOnAbp.OrderingService.Domain.csproj", "{F2840BC7-0188-4606-9126-DADD0F5ABF7A}" |
|||
EndProject |
|||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EShopOnAbp.OrderingService.Application.Contracts", "src\EShopOnAbp.OrderingService.Application.Contracts\EShopOnAbp.OrderingService.Application.Contracts.csproj", "{BD65D04F-08D5-40C1-8C24-77CA0BACB877}" |
|||
EndProject |
|||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EShopOnAbp.OrderingService.Application", "src\EShopOnAbp.OrderingService.Application\EShopOnAbp.OrderingService.Application.csproj", "{78040F9E-3501-4A40-82DF-00A597710F35}" |
|||
EndProject |
|||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{649A3FFA-182F-4E56-9717-E6A9A2BEC545}" |
|||
EndProject |
|||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{CCD2960C-23CC-4AB4-B84D-60C7AAA52F4D}" |
|||
EndProject |
|||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EShopOnAbp.OrderingService.EntityFrameworkCore", "src\EShopOnAbp.OrderingService.EntityFrameworkCore\EShopOnAbp.OrderingService.EntityFrameworkCore.csproj", "{0CE86223-D31D-4315-A1F5-87BA3EE1B844}" |
|||
EndProject |
|||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EShopOnAbp.OrderingService.HttpApi", "src\EShopOnAbp.OrderingService.HttpApi\EShopOnAbp.OrderingService.HttpApi.csproj", "{077AA5F8-8B61-420C-A6B5-0150A66FDB34}" |
|||
EndProject |
|||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EShopOnAbp.OrderingService.HttpApi.Client", "src\EShopOnAbp.OrderingService.HttpApi.Client\EShopOnAbp.OrderingService.HttpApi.Client.csproj", "{36E2735F-CEAB-44C8-A6D1-2CDAFF399751}" |
|||
EndProject |
|||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EShopOnAbp.OrderingService.TestBase", "test\EShopOnAbp.OrderingService.TestBase\EShopOnAbp.OrderingService.TestBase.csproj", "{C5BB573D-3030-4BCB-88B7-F6A85C32766C}" |
|||
EndProject |
|||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EShopOnAbp.OrderingService.EntityFrameworkCore.Tests", "test\EShopOnAbp.OrderingService.EntityFrameworkCore.Tests\EShopOnAbp.OrderingService.EntityFrameworkCore.Tests.csproj", "{527F645C-C1FC-406E-8479-81386C8ECF13}" |
|||
EndProject |
|||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EShopOnAbp.OrderingService.Domain.Tests", "test\EShopOnAbp.OrderingService.Domain.Tests\EShopOnAbp.OrderingService.Domain.Tests.csproj", "{E60895E5-79C4-447D-88B7-85CB5BA336A4}" |
|||
EndProject |
|||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EShopOnAbp.OrderingService.Application.Tests", "test\EShopOnAbp.OrderingService.Application.Tests\EShopOnAbp.OrderingService.Application.Tests.csproj", "{90CB5DC4-C040-45C7-8900-9688B26405BC}" |
|||
EndProject |
|||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EShopOnAbp.OrderingService.HttpApi.Client.ConsoleTestApp", "test\EShopOnAbp.OrderingService.HttpApi.Client.ConsoleTestApp\EShopOnAbp.OrderingService.HttpApi.Client.ConsoleTestApp.csproj", "{1EDCD6D4-DF3A-4E3B-ABB6-C0D0B373EAB8}" |
|||
EndProject |
|||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EShopOnAbp.OrderingService.HttpApi.Host", "src\EShopOnAbp.OrderingService.HttpApi.Host\EShopOnAbp.OrderingService.HttpApi.Host.csproj", "{714836C5-CFB1-4E29-BD1D-E2C9017A139D}" |
|||
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 |
|||
{BD65D04F-08D5-40C1-8C24-77CA0BACB877}.Debug|Any CPU.ActiveCfg = Debug|Any CPU |
|||
{BD65D04F-08D5-40C1-8C24-77CA0BACB877}.Debug|Any CPU.Build.0 = Debug|Any CPU |
|||
{BD65D04F-08D5-40C1-8C24-77CA0BACB877}.Release|Any CPU.ActiveCfg = Release|Any CPU |
|||
{BD65D04F-08D5-40C1-8C24-77CA0BACB877}.Release|Any CPU.Build.0 = Release|Any CPU |
|||
{78040F9E-3501-4A40-82DF-00A597710F35}.Debug|Any CPU.ActiveCfg = Debug|Any CPU |
|||
{78040F9E-3501-4A40-82DF-00A597710F35}.Debug|Any CPU.Build.0 = Debug|Any CPU |
|||
{78040F9E-3501-4A40-82DF-00A597710F35}.Release|Any CPU.ActiveCfg = Release|Any CPU |
|||
{78040F9E-3501-4A40-82DF-00A597710F35}.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 |
|||
{077AA5F8-8B61-420C-A6B5-0150A66FDB34}.Debug|Any CPU.ActiveCfg = Debug|Any CPU |
|||
{077AA5F8-8B61-420C-A6B5-0150A66FDB34}.Debug|Any CPU.Build.0 = Debug|Any CPU |
|||
{077AA5F8-8B61-420C-A6B5-0150A66FDB34}.Release|Any CPU.ActiveCfg = Release|Any CPU |
|||
{077AA5F8-8B61-420C-A6B5-0150A66FDB34}.Release|Any CPU.Build.0 = Release|Any CPU |
|||
{36E2735F-CEAB-44C8-A6D1-2CDAFF399751}.Debug|Any CPU.ActiveCfg = Debug|Any CPU |
|||
{36E2735F-CEAB-44C8-A6D1-2CDAFF399751}.Debug|Any CPU.Build.0 = Debug|Any CPU |
|||
{36E2735F-CEAB-44C8-A6D1-2CDAFF399751}.Release|Any CPU.ActiveCfg = Release|Any CPU |
|||
{36E2735F-CEAB-44C8-A6D1-2CDAFF399751}.Release|Any CPU.Build.0 = Release|Any CPU |
|||
{C5BB573D-3030-4BCB-88B7-F6A85C32766C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU |
|||
{C5BB573D-3030-4BCB-88B7-F6A85C32766C}.Debug|Any CPU.Build.0 = Debug|Any CPU |
|||
{C5BB573D-3030-4BCB-88B7-F6A85C32766C}.Release|Any CPU.ActiveCfg = Release|Any CPU |
|||
{C5BB573D-3030-4BCB-88B7-F6A85C32766C}.Release|Any CPU.Build.0 = Release|Any CPU |
|||
{527F645C-C1FC-406E-8479-81386C8ECF13}.Debug|Any CPU.ActiveCfg = Debug|Any CPU |
|||
{527F645C-C1FC-406E-8479-81386C8ECF13}.Debug|Any CPU.Build.0 = Debug|Any CPU |
|||
{527F645C-C1FC-406E-8479-81386C8ECF13}.Release|Any CPU.ActiveCfg = Release|Any CPU |
|||
{527F645C-C1FC-406E-8479-81386C8ECF13}.Release|Any CPU.Build.0 = Release|Any CPU |
|||
{E60895E5-79C4-447D-88B7-85CB5BA336A4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU |
|||
{E60895E5-79C4-447D-88B7-85CB5BA336A4}.Debug|Any CPU.Build.0 = Debug|Any CPU |
|||
{E60895E5-79C4-447D-88B7-85CB5BA336A4}.Release|Any CPU.ActiveCfg = Release|Any CPU |
|||
{E60895E5-79C4-447D-88B7-85CB5BA336A4}.Release|Any CPU.Build.0 = Release|Any CPU |
|||
{90CB5DC4-C040-45C7-8900-9688B26405BC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU |
|||
{90CB5DC4-C040-45C7-8900-9688B26405BC}.Debug|Any CPU.Build.0 = Debug|Any CPU |
|||
{90CB5DC4-C040-45C7-8900-9688B26405BC}.Release|Any CPU.ActiveCfg = Release|Any CPU |
|||
{90CB5DC4-C040-45C7-8900-9688B26405BC}.Release|Any CPU.Build.0 = Release|Any CPU |
|||
{1EDCD6D4-DF3A-4E3B-ABB6-C0D0B373EAB8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU |
|||
{1EDCD6D4-DF3A-4E3B-ABB6-C0D0B373EAB8}.Debug|Any CPU.Build.0 = Debug|Any CPU |
|||
{1EDCD6D4-DF3A-4E3B-ABB6-C0D0B373EAB8}.Release|Any CPU.ActiveCfg = Release|Any CPU |
|||
{1EDCD6D4-DF3A-4E3B-ABB6-C0D0B373EAB8}.Release|Any CPU.Build.0 = Release|Any CPU |
|||
{714836C5-CFB1-4E29-BD1D-E2C9017A139D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU |
|||
{714836C5-CFB1-4E29-BD1D-E2C9017A139D}.Debug|Any CPU.Build.0 = Debug|Any CPU |
|||
{714836C5-CFB1-4E29-BD1D-E2C9017A139D}.Release|Any CPU.ActiveCfg = Release|Any CPU |
|||
{714836C5-CFB1-4E29-BD1D-E2C9017A139D}.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} |
|||
{BD65D04F-08D5-40C1-8C24-77CA0BACB877} = {649A3FFA-182F-4E56-9717-E6A9A2BEC545} |
|||
{78040F9E-3501-4A40-82DF-00A597710F35} = {649A3FFA-182F-4E56-9717-E6A9A2BEC545} |
|||
{0CE86223-D31D-4315-A1F5-87BA3EE1B844} = {649A3FFA-182F-4E56-9717-E6A9A2BEC545} |
|||
{077AA5F8-8B61-420C-A6B5-0150A66FDB34} = {649A3FFA-182F-4E56-9717-E6A9A2BEC545} |
|||
{36E2735F-CEAB-44C8-A6D1-2CDAFF399751} = {649A3FFA-182F-4E56-9717-E6A9A2BEC545} |
|||
{C5BB573D-3030-4BCB-88B7-F6A85C32766C} = {CCD2960C-23CC-4AB4-B84D-60C7AAA52F4D} |
|||
{527F645C-C1FC-406E-8479-81386C8ECF13} = {CCD2960C-23CC-4AB4-B84D-60C7AAA52F4D} |
|||
{E60895E5-79C4-447D-88B7-85CB5BA336A4} = {CCD2960C-23CC-4AB4-B84D-60C7AAA52F4D} |
|||
{90CB5DC4-C040-45C7-8900-9688B26405BC} = {CCD2960C-23CC-4AB4-B84D-60C7AAA52F4D} |
|||
{1EDCD6D4-DF3A-4E3B-ABB6-C0D0B373EAB8} = {CCD2960C-23CC-4AB4-B84D-60C7AAA52F4D} |
|||
{714836C5-CFB1-4E29-BD1D-E2C9017A139D} = {649A3FFA-182F-4E56-9717-E6A9A2BEC545} |
|||
EndGlobalSection |
|||
GlobalSection(ExtensibilityGlobals) = postSolution |
|||
SolutionGuid = {6AAFA1C6-603E-13FA-45E5-7910AA9F661D} |
|||
EndGlobalSection |
|||
EndGlobal |
|||
@ -0,0 +1,16 @@ |
|||
<Project Sdk="Microsoft.NET.Sdk"> |
|||
|
|||
<Import Project="..\..\..\..\common.props" /> |
|||
|
|||
<PropertyGroup> |
|||
<TargetFramework>netstandard2.0</TargetFramework> |
|||
<RootNamespace>EShopOnAbp.OrderingService</RootNamespace> |
|||
</PropertyGroup> |
|||
|
|||
<ItemGroup> |
|||
<PackageReference Include="Volo.Abp.Ddd.Application.Contracts" Version="5.0.0-beta.1" /> |
|||
<PackageReference Include="Volo.Abp.Authorization" Version="5.0.0-beta.1" /> |
|||
<ProjectReference Include="..\EShopOnAbp.OrderingService.Domain.Shared\EShopOnAbp.OrderingService.Domain.Shared.csproj" /> |
|||
</ItemGroup> |
|||
|
|||
</Project> |
|||
@ -0,0 +1,16 @@ |
|||
using Volo.Abp.Application; |
|||
using Volo.Abp.Modularity; |
|||
using Volo.Abp.Authorization; |
|||
|
|||
namespace EShopOnAbp.OrderingService |
|||
{ |
|||
[DependsOn( |
|||
typeof(OrderingServiceDomainSharedModule), |
|||
typeof(AbpDddApplicationContractsModule), |
|||
typeof(AbpAuthorizationModule) |
|||
)] |
|||
public class OrderingServiceApplicationContractsModule : AbpModule |
|||
{ |
|||
|
|||
} |
|||
} |
|||
@ -0,0 +1,7 @@ |
|||
namespace EShopOnAbp.OrderingService |
|||
{ |
|||
public class OrderingServiceRemoteServiceConsts |
|||
{ |
|||
public const string RemoteServiceName = "OrderingService"; |
|||
} |
|||
} |
|||
@ -0,0 +1,19 @@ |
|||
using EShopOnAbp.OrderingService.Localization; |
|||
using Volo.Abp.Authorization.Permissions; |
|||
using Volo.Abp.Localization; |
|||
|
|||
namespace EShopOnAbp.OrderingService.Permissions |
|||
{ |
|||
public class OrderingServicePermissionDefinitionProvider : PermissionDefinitionProvider |
|||
{ |
|||
public override void Define(IPermissionDefinitionContext context) |
|||
{ |
|||
var myGroup = context.AddGroup(OrderingServicePermissions.GroupName, L("Permission:OrderingService")); |
|||
} |
|||
|
|||
private static LocalizableString L(string name) |
|||
{ |
|||
return LocalizableString.Create<OrderingServiceResource>(name); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,14 @@ |
|||
using Volo.Abp.Reflection; |
|||
|
|||
namespace EShopOnAbp.OrderingService.Permissions |
|||
{ |
|||
public class OrderingServicePermissions |
|||
{ |
|||
public const string GroupName = "OrderingService"; |
|||
|
|||
public static string[] GetAll() |
|||
{ |
|||
return ReflectionHelper.GetPublicConstantsRecursively(typeof(OrderingServicePermissions)); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,17 @@ |
|||
<Project Sdk="Microsoft.NET.Sdk"> |
|||
|
|||
<Import Project="..\..\..\..\common.props" /> |
|||
|
|||
<PropertyGroup> |
|||
<TargetFramework>netstandard2.0</TargetFramework> |
|||
<RootNamespace>EShopOnAbp.OrderingService</RootNamespace> |
|||
</PropertyGroup> |
|||
|
|||
<ItemGroup> |
|||
<PackageReference Include="Volo.Abp.AutoMapper" Version="5.0.0-beta.1" /> |
|||
<PackageReference Include="Volo.Abp.Ddd.Application" Version="5.0.0-beta.1" /> |
|||
<ProjectReference Include="..\EShopOnAbp.OrderingService.Application.Contracts\EShopOnAbp.OrderingService.Application.Contracts.csproj" /> |
|||
<ProjectReference Include="..\EShopOnAbp.OrderingService.Domain\EShopOnAbp.OrderingService.Domain.csproj" /> |
|||
</ItemGroup> |
|||
|
|||
</Project> |
|||
@ -0,0 +1,14 @@ |
|||
using EShopOnAbp.OrderingService.Localization; |
|||
using Volo.Abp.Application.Services; |
|||
|
|||
namespace EShopOnAbp.OrderingService |
|||
{ |
|||
public abstract class OrderingServiceAppService : ApplicationService |
|||
{ |
|||
protected OrderingServiceAppService() |
|||
{ |
|||
LocalizationResource = typeof(OrderingServiceResource); |
|||
ObjectMapperContext = typeof(OrderingServiceApplicationModule); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,14 @@ |
|||
using AutoMapper; |
|||
|
|||
namespace EShopOnAbp.OrderingService |
|||
{ |
|||
public class OrderingServiceApplicationAutoMapperProfile : Profile |
|||
{ |
|||
public OrderingServiceApplicationAutoMapperProfile() |
|||
{ |
|||
/* You can configure your AutoMapper mapping configuration here. |
|||
* Alternatively, you can split your mapping configurations |
|||
* into multiple profile classes for a better organization. */ |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,25 @@ |
|||
using Microsoft.Extensions.DependencyInjection; |
|||
using Volo.Abp.AutoMapper; |
|||
using Volo.Abp.Modularity; |
|||
using Volo.Abp.Application; |
|||
|
|||
namespace EShopOnAbp.OrderingService |
|||
{ |
|||
[DependsOn( |
|||
typeof(OrderingServiceDomainModule), |
|||
typeof(OrderingServiceApplicationContractsModule), |
|||
typeof(AbpDddApplicationModule), |
|||
typeof(AbpAutoMapperModule) |
|||
)] |
|||
public class OrderingServiceApplicationModule : AbpModule |
|||
{ |
|||
public override void ConfigureServices(ServiceConfigurationContext context) |
|||
{ |
|||
context.Services.AddAutoMapperObjectMapper<OrderingServiceApplicationModule>(); |
|||
Configure<AbpAutoMapperOptions>(options => |
|||
{ |
|||
options.AddMaps<OrderingServiceApplicationModule>(validate: true); |
|||
}); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,24 @@ |
|||
<Project Sdk="Microsoft.NET.Sdk"> |
|||
|
|||
<Import Project="..\..\..\..\common.props" /> |
|||
|
|||
<PropertyGroup> |
|||
<TargetFramework>netstandard2.0</TargetFramework> |
|||
<RootNamespace>EShopOnAbp.OrderingService</RootNamespace> |
|||
<GenerateEmbeddedFilesManifest>true</GenerateEmbeddedFilesManifest> |
|||
</PropertyGroup> |
|||
|
|||
<ItemGroup> |
|||
<PackageReference Include="Volo.Abp.Validation" Version="5.0.0-beta.1" /> |
|||
</ItemGroup> |
|||
|
|||
<ItemGroup> |
|||
<PackageReference Include="Microsoft.Extensions.FileProviders.Embedded" Version="6.0.0-rc.*" /> |
|||
</ItemGroup> |
|||
|
|||
<ItemGroup> |
|||
<EmbeddedResource Include="Localization\OrderingService\*.json" /> |
|||
<Content Remove="Localization\OrderingService\*.json" /> |
|||
</ItemGroup> |
|||
|
|||
</Project> |
|||
@ -0,0 +1,7 @@ |
|||
{ |
|||
"culture": "ar", |
|||
"texts": { |
|||
"MyAccount": "إدارة ملفى", |
|||
"SamplePageMessage": "صفحة نموذجية للوحدة النمطية OrderingService" |
|||
} |
|||
} |
|||
@ -0,0 +1,7 @@ |
|||
{ |
|||
"culture": "cs", |
|||
"texts": { |
|||
"MyAccount": "Spravovat profil", |
|||
"SamplePageMessage": "Ukázková stránka pro modul OrderingService" |
|||
} |
|||
} |
|||
@ -0,0 +1,7 @@ |
|||
{ |
|||
"culture": "de-DE", |
|||
"texts": { |
|||
"MyAccount": "Mein Konto", |
|||
"SamplePageMessage": "Eine Beispielseite für das Modul OrderingServiceModul" |
|||
} |
|||
} |
|||
@ -0,0 +1,7 @@ |
|||
{ |
|||
"culture": "en-GB", |
|||
"texts": { |
|||
"MyAccount": "My account", |
|||
"SamplePageMessage": "A sample page for the OrderingService module" |
|||
} |
|||
} |
|||
@ -0,0 +1,7 @@ |
|||
{ |
|||
"culture": "en", |
|||
"texts": { |
|||
"MyAccount": "My account", |
|||
"SamplePageMessage": "A sample page for the OrderingService module" |
|||
} |
|||
} |
|||
@ -0,0 +1,7 @@ |
|||
{ |
|||
"culture": "es", |
|||
"texts": { |
|||
"MyAccount": "Mi cuenta", |
|||
"SamplePageMessage": "Una página de ejemplo para el módulo OrderingService " |
|||
} |
|||
} |
|||
@ -0,0 +1,7 @@ |
|||
{ |
|||
"culture": "fi", |
|||
"texts": { |
|||
"MyAccount": "Tilini", |
|||
"SamplePageMessage": "Esimerkkisivu OrderingService-moduulille" |
|||
} |
|||
} |
|||
@ -0,0 +1,7 @@ |
|||
{ |
|||
"culture": "fr", |
|||
"texts": { |
|||
"MyAccount": "Mon compte", |
|||
"SamplePageMessage": "Exemple de page pour le module OrderingService" |
|||
} |
|||
} |
|||
@ -0,0 +1,7 @@ |
|||
{ |
|||
"culture": "hi", |
|||
"texts": { |
|||
"MyAccount": "मेरा खाता", |
|||
"SamplePageMessage": "OrderingService मॉड्यूल के लिए एक नमूना पृष्ठ" |
|||
} |
|||
} |
|||
@ -0,0 +1,7 @@ |
|||
{ |
|||
"culture": "hu", |
|||
"texts": { |
|||
"MyAccount": "A fiókom", |
|||
"SamplePageMessage": "Mintaoldal a OrderingService modulhoz" |
|||
} |
|||
} |
|||
@ -0,0 +1,7 @@ |
|||
{ |
|||
"culture": "it", |
|||
"texts": { |
|||
"MyAccount": "Il mio conto", |
|||
"SamplePageMessage": "Una pagina di esempio per il modulo OrderingService" |
|||
} |
|||
} |
|||
@ -0,0 +1,7 @@ |
|||
{ |
|||
"culture": "nl", |
|||
"texts": { |
|||
"MyAccount": "Mijn rekening", |
|||
"SamplePageMessage": "Een voorbeeldpagina voor de OrderingService module" |
|||
} |
|||
} |
|||
@ -0,0 +1,6 @@ |
|||
{ |
|||
"culture": "pl-PL", |
|||
"texts": { |
|||
|
|||
} |
|||
} |
|||
@ -0,0 +1,6 @@ |
|||
{ |
|||
"culture": "pt-BR", |
|||
"texts": { |
|||
|
|||
} |
|||
} |
|||
@ -0,0 +1,7 @@ |
|||
{ |
|||
"culture": "ro-RO", |
|||
"texts": { |
|||
"MyAccount": "Contul meu", |
|||
"SamplePageMessage": "Un exemplu de pagină pentru modululul OrderingService" |
|||
} |
|||
} |
|||
@ -0,0 +1,6 @@ |
|||
{ |
|||
"culture": "sk", |
|||
"texts": { |
|||
"SamplePageMessage": "Ukážka stránky pre modul OrderingService" |
|||
} |
|||
} |
|||
@ -0,0 +1,6 @@ |
|||
{ |
|||
"culture": "sl", |
|||
"texts": { |
|||
"MyAccount": "Moj račun" |
|||
} |
|||
} |
|||
@ -0,0 +1,7 @@ |
|||
{ |
|||
"culture": "tr", |
|||
"texts": { |
|||
"MyAccount": "Hesabım", |
|||
"SamplePageMessage": "OrderingService modulünden örnek bir sayfa" |
|||
} |
|||
} |
|||
@ -0,0 +1,6 @@ |
|||
{ |
|||
"culture": "vi", |
|||
"texts": { |
|||
|
|||
} |
|||
} |
|||
@ -0,0 +1,7 @@ |
|||
{ |
|||
"culture": "zh-Hans", |
|||
"texts": { |
|||
"MyAccount": "我的账户", |
|||
"SamplePageMessage": "OrderingService模块的示例页面" |
|||
} |
|||
} |
|||
@ -0,0 +1,6 @@ |
|||
{ |
|||
"culture": "zh-Hant", |
|||
"texts": { |
|||
"MyAccount": "我的賬戶" |
|||
} |
|||
} |
|||
@ -0,0 +1,10 @@ |
|||
using Volo.Abp.Localization; |
|||
|
|||
namespace EShopOnAbp.OrderingService.Localization |
|||
{ |
|||
[LocalizationResourceName("OrderingService")] |
|||
public class OrderingServiceResource |
|||
{ |
|||
|
|||
} |
|||
} |
|||
@ -0,0 +1,37 @@ |
|||
using Volo.Abp.Modularity; |
|||
using Volo.Abp.Localization; |
|||
using EShopOnAbp.OrderingService.Localization; |
|||
using Volo.Abp.Localization.ExceptionHandling; |
|||
using Volo.Abp.Validation; |
|||
using Volo.Abp.Validation.Localization; |
|||
using Volo.Abp.VirtualFileSystem; |
|||
|
|||
namespace EShopOnAbp.OrderingService |
|||
{ |
|||
[DependsOn( |
|||
typeof(AbpValidationModule) |
|||
)] |
|||
public class OrderingServiceDomainSharedModule : AbpModule |
|||
{ |
|||
public override void ConfigureServices(ServiceConfigurationContext context) |
|||
{ |
|||
Configure<AbpVirtualFileSystemOptions>(options => |
|||
{ |
|||
options.FileSets.AddEmbedded<OrderingServiceDomainSharedModule>(); |
|||
}); |
|||
|
|||
Configure<AbpLocalizationOptions>(options => |
|||
{ |
|||
options.Resources |
|||
.Add<OrderingServiceResource>("en") |
|||
.AddBaseTypes(typeof(AbpValidationResource)) |
|||
.AddVirtualJson("/Localization/OrderingService"); |
|||
}); |
|||
|
|||
Configure<AbpExceptionLocalizationOptions>(options => |
|||
{ |
|||
options.MapCodeNamespace("OrderingService", typeof(OrderingServiceResource)); |
|||
}); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,7 @@ |
|||
namespace EShopOnAbp.OrderingService |
|||
{ |
|||
public static class OrderingServiceErrorCodes |
|||
{ |
|||
//Add your business exception error codes here...
|
|||
} |
|||
} |
|||
@ -0,0 +1,15 @@ |
|||
<Project Sdk="Microsoft.NET.Sdk"> |
|||
|
|||
<Import Project="..\..\..\..\common.props" /> |
|||
|
|||
<PropertyGroup> |
|||
<TargetFramework>netstandard2.0</TargetFramework> |
|||
<RootNamespace>EShopOnAbp.OrderingService</RootNamespace> |
|||
</PropertyGroup> |
|||
|
|||
<ItemGroup> |
|||
<PackageReference Include="Volo.Abp.Ddd.Domain" Version="5.0.0-beta.1" /> |
|||
<ProjectReference Include="..\EShopOnAbp.OrderingService.Domain.Shared\EShopOnAbp.OrderingService.Domain.Shared.csproj" /> |
|||
</ItemGroup> |
|||
|
|||
</Project> |
|||
@ -0,0 +1,11 @@ |
|||
namespace EShopOnAbp.OrderingService |
|||
{ |
|||
public static class OrderingServiceDbProperties |
|||
{ |
|||
public static string DbTablePrefix { get; set; } = ""; |
|||
|
|||
public static string DbSchema { get; set; } |
|||
|
|||
public const string ConnectionStringName = "OrderingService"; |
|||
} |
|||
} |
|||
@ -0,0 +1,14 @@ |
|||
using Volo.Abp.Domain; |
|||
using Volo.Abp.Modularity; |
|||
|
|||
namespace EShopOnAbp.OrderingService |
|||
{ |
|||
[DependsOn( |
|||
typeof(AbpDddDomainModule), |
|||
typeof(OrderingServiceDomainSharedModule) |
|||
)] |
|||
public class OrderingServiceDomainModule : AbpModule |
|||
{ |
|||
|
|||
} |
|||
} |
|||
@ -0,0 +1,14 @@ |
|||
using Volo.Abp.Settings; |
|||
|
|||
namespace EShopOnAbp.OrderingService.Settings |
|||
{ |
|||
public class OrderingServiceSettingDefinitionProvider : SettingDefinitionProvider |
|||
{ |
|||
public override void Define(ISettingDefinitionContext context) |
|||
{ |
|||
/* Define module settings here. |
|||
* Use names from OrderingServiceSettings class. |
|||
*/ |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,11 @@ |
|||
namespace EShopOnAbp.OrderingService.Settings |
|||
{ |
|||
public static class OrderingServiceSettings |
|||
{ |
|||
public const string GroupName = "OrderingService"; |
|||
|
|||
/* Add constants for setting names. Example: |
|||
* public const string MySettingName = GroupName + ".MySettingName"; |
|||
*/ |
|||
} |
|||
} |
|||
@ -0,0 +1,22 @@ |
|||
<Project Sdk="Microsoft.NET.Sdk"> |
|||
|
|||
<Import Project="..\..\..\..\common.props" /> |
|||
|
|||
<PropertyGroup> |
|||
<TargetFramework>net6.0</TargetFramework> |
|||
<RootNamespace>EShopOnAbp.OrderingService</RootNamespace> |
|||
</PropertyGroup> |
|||
|
|||
<ItemGroup> |
|||
<ProjectReference Include="..\EShopOnAbp.OrderingService.Domain\EShopOnAbp.OrderingService.Domain.csproj" /> |
|||
<PackageReference Include="Volo.Abp.EntityFrameworkCore.SqlServer" Version="5.0.0-beta.1" /> |
|||
</ItemGroup> |
|||
|
|||
<ItemGroup> |
|||
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="6.0.0-rc.*"> |
|||
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets> |
|||
<PrivateAssets>compile; contentFiles; build; buildMultitargeting; buildTransitive; analyzers; native</PrivateAssets> |
|||
</PackageReference> |
|||
</ItemGroup> |
|||
|
|||
</Project> |
|||
@ -0,0 +1,13 @@ |
|||
using Volo.Abp.Data; |
|||
using Volo.Abp.EntityFrameworkCore; |
|||
|
|||
namespace EShopOnAbp.OrderingService.EntityFrameworkCore |
|||
{ |
|||
[ConnectionStringName(OrderingServiceDbProperties.ConnectionStringName)] |
|||
public interface IOrderingServiceDbContext : IEfCoreDbContext |
|||
{ |
|||
/* Add DbSet for each Aggregate Root here. Example: |
|||
* DbSet<Question> Questions { get; } |
|||
*/ |
|||
} |
|||
} |
|||
@ -0,0 +1,35 @@ |
|||
using Microsoft.EntityFrameworkCore; |
|||
using Volo.Abp.Data; |
|||
using Volo.Abp.DependencyInjection; |
|||
using Volo.Abp.EntityFrameworkCore; |
|||
|
|||
namespace EShopOnAbp.OrderingService.EntityFrameworkCore |
|||
{ |
|||
[ConnectionStringName("Default")] |
|||
public class OrderingServiceDbContext : |
|||
AbpDbContext<OrderingServiceDbContext> |
|||
{ |
|||
public OrderingServiceDbContext(DbContextOptions<OrderingServiceDbContext> options) |
|||
: base(options) |
|||
{ |
|||
|
|||
} |
|||
|
|||
protected override void OnModelCreating(ModelBuilder builder) |
|||
{ |
|||
base.OnModelCreating(builder); |
|||
|
|||
/* Include modules to your migration db context */ |
|||
|
|||
builder.ConfigureOrderingService(); |
|||
/* Configure your own tables/entities inside here */ |
|||
|
|||
//builder.Entity<YourEntity>(b =>
|
|||
//{
|
|||
// b.ToTable(OrderingServiceConsts.DbTablePrefix + "YourEntities", OrderingServiceConsts.DbSchema);
|
|||
// b.ConfigureByConvention(); //auto configure for the base class props
|
|||
// //...
|
|||
//});
|
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,33 @@ |
|||
using System.IO; |
|||
using Microsoft.EntityFrameworkCore; |
|||
using Microsoft.EntityFrameworkCore.Design; |
|||
using Microsoft.Extensions.Configuration; |
|||
|
|||
namespace EShopOnAbp.OrderingService.EntityFrameworkCore |
|||
{ |
|||
/* This class is needed for EF Core console commands |
|||
* (like Add-Migration and Update-Database commands) */ |
|||
public class OrderingServiceDbContextFactory : IDesignTimeDbContextFactory<OrderingServiceDbContext> |
|||
{ |
|||
public OrderingServiceDbContext CreateDbContext(string[] args) |
|||
{ |
|||
OrderingServiceEfCoreEntityExtensionMappings.Configure(); |
|||
|
|||
var configuration = BuildConfiguration(); |
|||
|
|||
var builder = new DbContextOptionsBuilder<OrderingServiceDbContext>() |
|||
.UseSqlServer(configuration.GetConnectionString("Default")); |
|||
|
|||
return new OrderingServiceDbContext(builder.Options); |
|||
} |
|||
|
|||
private static IConfigurationRoot BuildConfiguration() |
|||
{ |
|||
var builder = new ConfigurationBuilder() |
|||
.SetBasePath(Path.Combine(Directory.GetCurrentDirectory(), "../EShopOnAbp.OrderingService.HttpApi.Host/")) |
|||
.AddJsonFile("appsettings.json", optional: false); |
|||
|
|||
return builder.Build(); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,34 @@ |
|||
using Microsoft.EntityFrameworkCore; |
|||
using Volo.Abp; |
|||
|
|||
namespace EShopOnAbp.OrderingService.EntityFrameworkCore |
|||
{ |
|||
public static class OrderingServiceDbContextModelCreatingExtensions |
|||
{ |
|||
public static void ConfigureOrderingService( |
|||
this ModelBuilder builder) |
|||
{ |
|||
Check.NotNull(builder, nameof(builder)); |
|||
|
|||
/* Configure all entities here. Example: |
|||
|
|||
builder.Entity<Question>(b => |
|||
{ |
|||
//Configure table & schema name
|
|||
b.ToTable(OrderingServiceDbProperties.DbTablePrefix + "Questions", OrderingServiceDbProperties.DbSchema); |
|||
|
|||
b.ConfigureByConvention(); |
|||
|
|||
//Properties
|
|||
b.Property(q => q.Title).IsRequired().HasMaxLength(QuestionConsts.MaxTitleLength); |
|||
|
|||
//Relations
|
|||
b.HasMany(question => question.Tags).WithOne().HasForeignKey(qt => qt.QuestionId); |
|||
|
|||
//Indexes
|
|||
b.HasIndex(q => q.CreationTime); |
|||
}); |
|||
*/ |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,39 @@ |
|||
using Volo.Abp.Threading; |
|||
|
|||
namespace EShopOnAbp.OrderingService.EntityFrameworkCore |
|||
{ |
|||
public static class OrderingServiceEfCoreEntityExtensionMappings |
|||
{ |
|||
private static readonly OneTimeRunner OneTimeRunner = new OneTimeRunner(); |
|||
|
|||
public static void Configure() |
|||
{ |
|||
OneTimeRunner.Run(() => |
|||
{ |
|||
/* You can configure extra properties for the |
|||
* entities defined in the modules used by your application. |
|||
* |
|||
* This class can be used to map these extra properties to table fields in the database. |
|||
* |
|||
* USE THIS CLASS ONLY TO CONFIGURE EF CORE RELATED MAPPING. |
|||
* USE OrderingServiceModuleExtensionConfigurator CLASS (in the Domain.Shared project) |
|||
* FOR A HIGH LEVEL API TO DEFINE EXTRA PROPERTIES TO ENTITIES OF THE USED MODULES |
|||
* |
|||
* Example: Map a property to a table field: |
|||
|
|||
ObjectExtensionManager.Instance |
|||
.MapEfCoreProperty<IdentityUser, string>( |
|||
"MyProperty", |
|||
(entityBuilder, propertyBuilder) => |
|||
{ |
|||
propertyBuilder.HasMaxLength(128); |
|||
} |
|||
); |
|||
|
|||
* See the documentation for more: |
|||
* https://docs.abp.io/en/abp/latest/Customizing-Application-Modules-Extending-Entities
|
|||
*/ |
|||
}); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,36 @@ |
|||
using Microsoft.Extensions.DependencyInjection; |
|||
using Volo.Abp.EntityFrameworkCore; |
|||
using Volo.Abp.EntityFrameworkCore.SqlServer; |
|||
using Volo.Abp.Modularity; |
|||
|
|||
namespace EShopOnAbp.OrderingService.EntityFrameworkCore |
|||
{ |
|||
[DependsOn( |
|||
typeof(OrderingServiceDomainModule), |
|||
typeof(AbpEntityFrameworkCoreSqlServerModule) |
|||
)] |
|||
public class OrderingServiceEntityFrameworkCoreModule : AbpModule |
|||
{ |
|||
public override void PreConfigureServices(ServiceConfigurationContext context) |
|||
{ |
|||
OrderingServiceEfCoreEntityExtensionMappings.Configure(); |
|||
} |
|||
|
|||
public override void ConfigureServices(ServiceConfigurationContext context) |
|||
{ |
|||
context.Services.AddAbpDbContext<OrderingServiceDbContext>(options => |
|||
{ |
|||
/* Remove "includeAllEntities: true" to create |
|||
* default repositories only for aggregate roots */ |
|||
options.AddDefaultRepositories(includeAllEntities: true); |
|||
}); |
|||
|
|||
Configure<AbpDbContextOptions>(options => |
|||
{ |
|||
/* The main point to change your DBMS. |
|||
* See also OrderingServiceMigrationsDbContextFactory for EF Core tooling. */ |
|||
options.UseSqlServer(); |
|||
}); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,30 @@ |
|||
// <auto-generated />
|
|||
using EShopOnAbp.OrderingService.EntityFrameworkCore; |
|||
using Microsoft.EntityFrameworkCore; |
|||
using Microsoft.EntityFrameworkCore.Infrastructure; |
|||
using Microsoft.EntityFrameworkCore.Metadata; |
|||
using Microsoft.EntityFrameworkCore.Migrations; |
|||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion; |
|||
using Volo.Abp.EntityFrameworkCore; |
|||
|
|||
#nullable disable |
|||
|
|||
namespace EShopOnAbp.OrderingService.Migrations |
|||
{ |
|||
[DbContext(typeof(OrderingServiceDbContext))] |
|||
[Migration("20211012121150_Initial")] |
|||
partial class Initial |
|||
{ |
|||
protected override void BuildTargetModel(ModelBuilder modelBuilder) |
|||
{ |
|||
#pragma warning disable 612, 618
|
|||
modelBuilder |
|||
.HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.SqlServer) |
|||
.HasAnnotation("ProductVersion", "6.0.0-rc.1.21452.10") |
|||
.HasAnnotation("Relational:MaxIdentifierLength", 128); |
|||
|
|||
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder, 1L, 1); |
|||
#pragma warning restore 612, 618
|
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,19 @@ |
|||
using Microsoft.EntityFrameworkCore.Migrations; |
|||
|
|||
#nullable disable |
|||
|
|||
namespace EShopOnAbp.OrderingService.Migrations |
|||
{ |
|||
public partial class Initial : Migration |
|||
{ |
|||
protected override void Up(MigrationBuilder migrationBuilder) |
|||
{ |
|||
|
|||
} |
|||
|
|||
protected override void Down(MigrationBuilder migrationBuilder) |
|||
{ |
|||
|
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,28 @@ |
|||
// <auto-generated />
|
|||
using EShopOnAbp.OrderingService.EntityFrameworkCore; |
|||
using Microsoft.EntityFrameworkCore; |
|||
using Microsoft.EntityFrameworkCore.Infrastructure; |
|||
using Microsoft.EntityFrameworkCore.Metadata; |
|||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion; |
|||
using Volo.Abp.EntityFrameworkCore; |
|||
|
|||
#nullable disable |
|||
|
|||
namespace EShopOnAbp.OrderingService.Migrations |
|||
{ |
|||
[DbContext(typeof(OrderingServiceDbContext))] |
|||
partial class OrderingServiceDbContextModelSnapshot : ModelSnapshot |
|||
{ |
|||
protected override void BuildModel(ModelBuilder modelBuilder) |
|||
{ |
|||
#pragma warning disable 612, 618
|
|||
modelBuilder |
|||
.HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.SqlServer) |
|||
.HasAnnotation("ProductVersion", "6.0.0-rc.1.21452.10") |
|||
.HasAnnotation("Relational:MaxIdentifierLength", 128); |
|||
|
|||
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder, 1L, 1); |
|||
#pragma warning restore 612, 618
|
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,2 @@ |
|||
using System.Runtime.CompilerServices; |
|||
[assembly:InternalsVisibleToAttribute("EShopOnAbp.OrderingService.EntityFrameworkCore.Tests")] |
|||
@ -0,0 +1,53 @@ |
|||
{ |
|||
"modules": { |
|||
"OrderingService": { |
|||
"rootPath": "OrderingService", |
|||
"remoteServiceName": "OrderingService", |
|||
"controllers": { |
|||
"EShopOnAbp.OrderingService.Samples.SampleController": { |
|||
"controllerName": "Sample", |
|||
"controllerGroupName": "Sample", |
|||
"type": "EShopOnAbp.OrderingService.Samples.SampleController", |
|||
"interfaces": [ |
|||
{ |
|||
"type": "EShopOnAbp.OrderingService.Samples.ISampleAppService" |
|||
} |
|||
], |
|||
"actions": { |
|||
"GetAsync": { |
|||
"uniqueName": "GetAsync", |
|||
"name": "GetAsync", |
|||
"httpMethod": "GET", |
|||
"url": "api/OrderingService/sample", |
|||
"supportedVersions": [], |
|||
"parametersOnMethod": [], |
|||
"parameters": [], |
|||
"returnValue": { |
|||
"type": "EShopOnAbp.OrderingService.Samples.SampleDto", |
|||
"typeSimple": "EShopOnAbp.OrderingService.Samples.SampleDto" |
|||
}, |
|||
"allowAnonymous": null, |
|||
"implementFrom": "EShopOnAbp.OrderingService.Samples.ISampleAppService" |
|||
}, |
|||
"GetAuthorizedAsync": { |
|||
"uniqueName": "GetAuthorizedAsync", |
|||
"name": "GetAuthorizedAsync", |
|||
"httpMethod": "GET", |
|||
"url": "api/OrderingService/sample/authorized", |
|||
"supportedVersions": [], |
|||
"parametersOnMethod": [], |
|||
"parameters": [], |
|||
"returnValue": { |
|||
"type": "EShopOnAbp.OrderingService.Samples.SampleDto", |
|||
"typeSimple": "EShopOnAbp.OrderingService.Samples.SampleDto" |
|||
}, |
|||
"allowAnonymous": false, |
|||
"implementFrom": "EShopOnAbp.OrderingService.Samples.ISampleAppService" |
|||
} |
|||
} |
|||
} |
|||
} |
|||
} |
|||
}, |
|||
"types": {} |
|||
} |
|||
@ -0,0 +1,15 @@ |
|||
// This file is automatically generated by ABP framework to use MVC Controllers from CSharp
|
|||
using System; |
|||
using System.Threading.Tasks; |
|||
using Volo.Abp.Application.Dtos; |
|||
using Volo.Abp.Http.Client; |
|||
using Volo.Abp.Http.Modeling; |
|||
using Volo.Abp.DependencyInjection; |
|||
using Volo.Abp.Http.Client.ClientProxying; |
|||
using EShopOnAbp.OrderingService.Samples; |
|||
|
|||
// ReSharper disable once CheckNamespace
|
|||
namespace EShopOnAbp.OrderingService.Samples.ClientProxies |
|||
{ |
|||
|
|||
} |
|||
@ -0,0 +1,8 @@ |
|||
// This file is part of SampleClientProxy, you can customize it here
|
|||
// ReSharper disable once CheckNamespace
|
|||
namespace EShopOnAbp.OrderingService.Samples.ClientProxies |
|||
{ |
|||
public partial class SampleClientProxy |
|||
{ |
|||
} |
|||
} |
|||
@ -0,0 +1,20 @@ |
|||
<Project Sdk="Microsoft.NET.Sdk"> |
|||
|
|||
<Import Project="..\..\..\..\common.props" /> |
|||
|
|||
<PropertyGroup> |
|||
<TargetFramework>netstandard2.0</TargetFramework> |
|||
<RootNamespace>EShopOnAbp.OrderingService</RootNamespace> |
|||
</PropertyGroup> |
|||
|
|||
<ItemGroup> |
|||
<PackageReference Include="Volo.Abp.Http.Client" Version="5.0.0-beta.1" /> |
|||
<ProjectReference Include="..\EShopOnAbp.OrderingService.Application.Contracts\EShopOnAbp.OrderingService.Application.Contracts.csproj" /> |
|||
</ItemGroup> |
|||
|
|||
<ItemGroup> |
|||
<EmbeddedResource Include="**\*generate-proxy.json" /> |
|||
<Content Remove="**\*generate-proxy.json" /> |
|||
</ItemGroup> |
|||
|
|||
</Project> |
|||
@ -0,0 +1,27 @@ |
|||
using Microsoft.Extensions.DependencyInjection; |
|||
using Volo.Abp.Http.Client; |
|||
using Volo.Abp.Modularity; |
|||
using Volo.Abp.VirtualFileSystem; |
|||
|
|||
namespace EShopOnAbp.OrderingService |
|||
{ |
|||
[DependsOn( |
|||
typeof(OrderingServiceApplicationContractsModule), |
|||
typeof(AbpHttpClientModule))] |
|||
public class OrderingServiceHttpApiClientModule : AbpModule |
|||
{ |
|||
public override void ConfigureServices(ServiceConfigurationContext context) |
|||
{ |
|||
context.Services.AddStaticHttpClientProxies( |
|||
typeof(OrderingServiceApplicationContractsModule).Assembly, |
|||
OrderingServiceRemoteServiceConsts.RemoteServiceName |
|||
); |
|||
|
|||
Configure<AbpVirtualFileSystemOptions>(options => |
|||
{ |
|||
options.FileSets.AddEmbedded<OrderingServiceHttpApiClientModule>(); |
|||
}); |
|||
|
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,13 @@ |
|||
using Microsoft.AspNetCore.Mvc; |
|||
using Volo.Abp.AspNetCore.Mvc; |
|||
|
|||
namespace EShopOnAbp.OrderingService.Controllers |
|||
{ |
|||
public class HomeController : AbpController |
|||
{ |
|||
public ActionResult Index() |
|||
{ |
|||
return Redirect("~/swagger"); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,27 @@ |
|||
using EShopOnAbp.OrderingService.EntityFrameworkCore; |
|||
using EShopOnAbp.Shared.Hosting.Microservices.DbMigrations; |
|||
using System; |
|||
using Volo.Abp.EventBus.Distributed; |
|||
using Volo.Abp.MultiTenancy; |
|||
using Volo.Abp.Uow; |
|||
|
|||
namespace EShopOnAbp.OrderingService.DbMigrations |
|||
{ |
|||
public class OrderingServiceDatabaseMigrationChecker : PendingMigrationsCheckerBase<OrderingServiceDbContext> |
|||
{ |
|||
public OrderingServiceDatabaseMigrationChecker( |
|||
IUnitOfWorkManager unitOfWorkManager, |
|||
IServiceProvider serviceProvider, |
|||
ICurrentTenant currentTenant, |
|||
IDistributedEventBus distributedEventBus) |
|||
: base( |
|||
unitOfWorkManager, |
|||
serviceProvider, |
|||
currentTenant, |
|||
distributedEventBus, |
|||
OrderingServiceDbProperties.ConnectionStringName) |
|||
{ |
|||
|
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,52 @@ |
|||
using EShopOnAbp.OrderingService.EntityFrameworkCore; |
|||
using EShopOnAbp.Shared.Hosting.Microservices.DbMigrations; |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using System.Text; |
|||
using System.Threading.Tasks; |
|||
using Volo.Abp.Data; |
|||
using Volo.Abp.EventBus.Distributed; |
|||
using Volo.Abp.MultiTenancy; |
|||
using Volo.Abp.TenantManagement; |
|||
using Volo.Abp.Uow; |
|||
|
|||
namespace EShopOnAbp.OrderingService.DbMigrations |
|||
{ |
|||
public class OrderingServiceDatabaseMigrationEventHandler |
|||
: DatabaseMigrationEventHandlerBase<OrderingServiceDbContext>, |
|||
IDistributedEventHandler<ApplyDatabaseMigrationsEto> |
|||
{ |
|||
public OrderingServiceDatabaseMigrationEventHandler( |
|||
ICurrentTenant currentTenant, |
|||
IUnitOfWorkManager unitOfWorkManager, |
|||
ITenantStore tenantStore, |
|||
ITenantRepository tenantRepository, |
|||
IDistributedEventBus distributedEventBus, |
|||
string databaseName) : base(currentTenant, unitOfWorkManager, tenantStore, tenantRepository, distributedEventBus, databaseName) |
|||
{ |
|||
} |
|||
|
|||
public async Task HandleEventAsync(ApplyDatabaseMigrationsEto eventData) |
|||
{ |
|||
if (eventData.DatabaseName != DatabaseName) |
|||
{ |
|||
return; |
|||
} |
|||
|
|||
if (eventData.TenantId != null) |
|||
{ |
|||
return; |
|||
} |
|||
|
|||
try |
|||
{ |
|||
await MigrateDatabaseSchemaAsync(null); |
|||
} |
|||
catch (Exception ex) |
|||
{ |
|||
await HandleErrorOnApplyDatabaseMigrationAsync(eventData, ex); |
|||
} |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,35 @@ |
|||
<Project Sdk="Microsoft.NET.Sdk.Web"> |
|||
|
|||
<Import Project="..\..\..\..\common.props" /> |
|||
|
|||
<PropertyGroup> |
|||
<TargetFramework>net6.0</TargetFramework> |
|||
<RootNamespace>EShopOnAbp.OrderingService</RootNamespace> |
|||
<PreserveCompilationReferences>true</PreserveCompilationReferences> |
|||
<UserSecretsId>EShopOnAbp.OrderingService-c2d31439-b723-48e2-b061-5ebd7aeb6010</UserSecretsId> |
|||
</PropertyGroup> |
|||
|
|||
<ItemGroup> |
|||
<PackageReference Include="Volo.Abp.Http.Client.IdentityModel.Web" Version="5.0.0-beta.1" /> |
|||
<PackageReference Include="Volo.Abp.Identity.HttpApi.Client" Version="5.0.0-beta.1" /> |
|||
<PackageReference Include="Volo.Abp.Account.Application.Contracts" Version="5.0.0-beta.1" /> |
|||
</ItemGroup> |
|||
|
|||
<ItemGroup> |
|||
<ProjectReference Include="..\..\..\..\shared\EShopOnAbp.Shared.Hosting.Microservices\EShopOnAbp.Shared.Hosting.Microservices.csproj" /> |
|||
</ItemGroup> |
|||
|
|||
<ItemGroup> |
|||
<ProjectReference Include="..\EShopOnAbp.OrderingService.Application\EShopOnAbp.OrderingService.Application.csproj" /> |
|||
<ProjectReference Include="..\EShopOnAbp.OrderingService.EntityFrameworkCore\EShopOnAbp.OrderingService.EntityFrameworkCore.csproj" /> |
|||
<ProjectReference Include="..\EShopOnAbp.OrderingService.HttpApi\EShopOnAbp.OrderingService.HttpApi.csproj" /> |
|||
</ItemGroup> |
|||
|
|||
<ItemGroup> |
|||
<Compile Remove="Logs\**" /> |
|||
<Content Remove="Logs\**" /> |
|||
<EmbeddedResource Remove="Logs\**" /> |
|||
<None Remove="Logs\**" /> |
|||
</ItemGroup> |
|||
|
|||
</Project> |
|||
@ -0,0 +1,94 @@ |
|||
using EShopOnAbp.OrderingService.EntityFrameworkCore; |
|||
using EShopOnAbp.Shared.Hosting.AspNetCore; |
|||
using EShopOnAbp.Shared.Hosting.Microservices; |
|||
using Microsoft.AspNetCore.Builder; |
|||
using Microsoft.AspNetCore.Cors; |
|||
using Microsoft.Extensions.DependencyInjection; |
|||
using Microsoft.Extensions.Hosting; |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using Volo.Abp; |
|||
using Volo.Abp.Modularity; |
|||
|
|||
namespace EShopOnAbp.OrderingService |
|||
{ |
|||
[DependsOn( |
|||
typeof(OrderingServiceHttpApiModule), |
|||
typeof(OrderingServiceApplicationModule), |
|||
typeof(OrderingServiceEntityFrameworkCoreModule), |
|||
typeof(EShopOnAbpSharedHostingMicroservicesModule) |
|||
)] |
|||
public class OrderingServiceHttpApiHostModule : AbpModule |
|||
{ |
|||
|
|||
public override void ConfigureServices(ServiceConfigurationContext context) |
|||
{ |
|||
var hostingEnvironment = context.Services.GetHostingEnvironment(); |
|||
var configuration = context.Services.GetConfiguration(); |
|||
|
|||
JwtBearerConfigurationHelper.Configure(context, "OrderingService"); |
|||
// SwaggerConfigurationHelper.Configure(context, "Catalog Service API");
|
|||
|
|||
SwaggerWithAuthConfigurationHelper.Configure( |
|||
context: context, |
|||
authority: configuration["AuthServer:Authority"], |
|||
scopes: new Dictionary<string, string> /* Requested scopes for authorization code request and descriptions for swagger UI only */ |
|||
{ |
|||
{"OrderingService", "Ordering Service API"}, |
|||
}, |
|||
apiTitle: "Ordering Service API" |
|||
); |
|||
|
|||
context.Services.AddCors(options => |
|||
{ |
|||
options.AddDefaultPolicy(builder => |
|||
{ |
|||
builder |
|||
.WithOrigins( |
|||
configuration["App:CorsOrigins"] |
|||
.Split(",", StringSplitOptions.RemoveEmptyEntries) |
|||
.Select(o => o.Trim().RemovePostFix("/")) |
|||
.ToArray() |
|||
) |
|||
.WithAbpExposedHeaders() |
|||
.SetIsOriginAllowedToAllowWildcardSubdomains() |
|||
.AllowAnyHeader() |
|||
.AllowAnyMethod() |
|||
.AllowCredentials(); |
|||
}); |
|||
}); |
|||
} |
|||
|
|||
public override void OnApplicationInitialization(ApplicationInitializationContext context) |
|||
{ |
|||
var app = context.GetApplicationBuilder(); |
|||
var env = context.GetEnvironment(); |
|||
|
|||
if (env.IsDevelopment()) |
|||
{ |
|||
app.UseDeveloperExceptionPage(); |
|||
} |
|||
|
|||
app.UseCorrelationId(); |
|||
app.UseCors(); |
|||
app.UseAbpRequestLocalization(); |
|||
app.UseStaticFiles(); |
|||
app.UseRouting(); |
|||
// app.UseHttpMetrics();
|
|||
app.UseAuthentication(); |
|||
app.UseAbpClaimsMap(); |
|||
app.UseMultiTenancy(); |
|||
app.UseAuthorization(); |
|||
app.UseSwagger(); |
|||
app.UseSwaggerUI(options => { options.SwaggerEndpoint("/swagger/v1/swagger.json", "Saas Service API"); }); |
|||
app.UseAbpSerilogEnrichers(); |
|||
app.UseAuditing(); |
|||
app.UseUnitOfWork(); |
|||
app.UseConfiguredEndpoints(endpoints => |
|||
{ |
|||
// endpoints.MapMetrics();
|
|||
}); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,56 @@ |
|||
using System; |
|||
using System.IO; |
|||
using Microsoft.AspNetCore.Hosting; |
|||
using Microsoft.Extensions.Configuration; |
|||
using Microsoft.Extensions.Hosting; |
|||
using Serilog; |
|||
using Serilog.Events; |
|||
|
|||
namespace EShopOnAbp.OrderingService |
|||
{ |
|||
public class Program |
|||
{ |
|||
public static int Main(string[] args) |
|||
{ |
|||
Log.Logger = new LoggerConfiguration() |
|||
#if DEBUG
|
|||
.MinimumLevel.Debug() |
|||
#else
|
|||
.MinimumLevel.Information() |
|||
#endif
|
|||
.MinimumLevel.Override("Microsoft", LogEventLevel.Information) |
|||
.Enrich.FromLogContext() |
|||
.WriteTo.Async(c => c.File("Logs/logs.txt")) |
|||
#if DEBUG
|
|||
.WriteTo.Async(c => c.Console()) |
|||
#endif
|
|||
.CreateLogger(); |
|||
|
|||
try |
|||
{ |
|||
Log.Information("Starting web host."); |
|||
CreateHostBuilder(args).Build().Run(); |
|||
return 0; |
|||
} |
|||
catch (Exception ex) |
|||
{ |
|||
Log.Fatal(ex, "Host terminated unexpectedly!"); |
|||
return 1; |
|||
} |
|||
finally |
|||
{ |
|||
Log.CloseAndFlush(); |
|||
} |
|||
} |
|||
|
|||
internal static IHostBuilder CreateHostBuilder(string[] args) => |
|||
Host.CreateDefaultBuilder(args) |
|||
.AddAppSettingsSecretsJson() |
|||
.ConfigureWebHostDefaults(webBuilder => |
|||
{ |
|||
webBuilder.UseStartup<Startup>(); |
|||
}) |
|||
.UseAutofac() |
|||
.UseSerilog(); |
|||
} |
|||
} |
|||
@ -0,0 +1,27 @@ |
|||
{ |
|||
"iisSettings": { |
|||
"windowsAuthentication": false, |
|||
"anonymousAuthentication": true, |
|||
"iisExpress": { |
|||
"applicationUrl": "https://localhost:44380", |
|||
"sslPort": 44380 |
|||
} |
|||
}, |
|||
"profiles": { |
|||
"IIS Express": { |
|||
"commandName": "IISExpress", |
|||
"launchBrowser": true, |
|||
"environmentVariables": { |
|||
"ASPNETCORE_ENVIRONMENT": "Development" |
|||
} |
|||
}, |
|||
"EShopOnAbp.OrderingService.DemoApp": { |
|||
"commandName": "Project", |
|||
"launchBrowser": true, |
|||
"applicationUrl": "https://localhost:44380", |
|||
"environmentVariables": { |
|||
"ASPNETCORE_ENVIRONMENT": "Development" |
|||
} |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,20 @@ |
|||
using Microsoft.AspNetCore.Builder; |
|||
using Microsoft.AspNetCore.Hosting; |
|||
using Microsoft.Extensions.DependencyInjection; |
|||
using Microsoft.Extensions.Logging; |
|||
|
|||
namespace EShopOnAbp.OrderingService |
|||
{ |
|||
public class Startup |
|||
{ |
|||
public void ConfigureServices(IServiceCollection services) |
|||
{ |
|||
services.AddApplication<OrderingServiceHttpApiHostModule>(); |
|||
} |
|||
|
|||
public void Configure(IApplicationBuilder app, IWebHostEnvironment env, ILoggerFactory loggerFactory) |
|||
{ |
|||
app.InitializeApplication(); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,18 @@ |
|||
{ |
|||
"App": { |
|||
"CorsOrigins": "https://*.OrderingService.com,http://localhost:4200,http://localhost:44307,https://localhost:44307" |
|||
}, |
|||
"ConnectionStrings": { |
|||
"Default": "Server=(LocalDb)\\MSSQLLocalDB;Database=OrderingService_Main;Trusted_Connection=True", |
|||
"OrderingService": "Server=(LocalDb)\\MSSQLLocalDB;Database=OrderingService_Module;Trusted_Connection=True" |
|||
}, |
|||
"Redis": { |
|||
"Configuration": "127.0.0.1" |
|||
}, |
|||
"AuthServer": { |
|||
"Authority": "https://localhost:44333/", |
|||
"RequireHttpsMetadata": "false", |
|||
"SwaggerClientId": "OrderingService_Swagger", |
|||
"SwaggerClientSecret": "1q2w3e*" |
|||
} |
|||
} |
|||
@ -0,0 +1,2 @@ |
|||
{ |
|||
} |
|||
@ -0,0 +1,15 @@ |
|||
<Project Sdk="Microsoft.NET.Sdk"> |
|||
|
|||
<Import Project="..\..\..\..\common.props" /> |
|||
|
|||
<PropertyGroup> |
|||
<TargetFramework>net6.0</TargetFramework> |
|||
<RootNamespace>EShopOnAbp.OrderingService</RootNamespace> |
|||
</PropertyGroup> |
|||
|
|||
<ItemGroup> |
|||
<PackageReference Include="Volo.Abp.AspNetCore.Mvc" Version="5.0.0-beta.1" /> |
|||
<ProjectReference Include="..\EShopOnAbp.OrderingService.Application.Contracts\EShopOnAbp.OrderingService.Application.Contracts.csproj" /> |
|||
</ItemGroup> |
|||
|
|||
</Project> |
|||
@ -0,0 +1,13 @@ |
|||
using EShopOnAbp.OrderingService.Localization; |
|||
using Volo.Abp.AspNetCore.Mvc; |
|||
|
|||
namespace EShopOnAbp.OrderingService |
|||
{ |
|||
public abstract class OrderingServiceController : AbpControllerBase |
|||
{ |
|||
protected OrderingServiceController() |
|||
{ |
|||
LocalizationResource = typeof(OrderingServiceResource); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,33 @@ |
|||
using Localization.Resources.AbpUi; |
|||
using EShopOnAbp.OrderingService.Localization; |
|||
using Volo.Abp.AspNetCore.Mvc; |
|||
using Volo.Abp.Localization; |
|||
using Volo.Abp.Modularity; |
|||
using Microsoft.Extensions.DependencyInjection; |
|||
|
|||
namespace EShopOnAbp.OrderingService |
|||
{ |
|||
[DependsOn( |
|||
typeof(OrderingServiceApplicationContractsModule), |
|||
typeof(AbpAspNetCoreMvcModule))] |
|||
public class OrderingServiceHttpApiModule : AbpModule |
|||
{ |
|||
public override void PreConfigureServices(ServiceConfigurationContext context) |
|||
{ |
|||
PreConfigure<IMvcBuilder>(mvcBuilder => |
|||
{ |
|||
mvcBuilder.AddApplicationPartIfNotExists(typeof(OrderingServiceHttpApiModule).Assembly); |
|||
}); |
|||
} |
|||
|
|||
public override void ConfigureServices(ServiceConfigurationContext context) |
|||
{ |
|||
Configure<AbpLocalizationOptions>(options => |
|||
{ |
|||
options.Resources |
|||
.Get<OrderingServiceResource>() |
|||
.AddBaseTypes(typeof(AbpUiResource)); |
|||
}); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,16 @@ |
|||
<Project Sdk="Microsoft.NET.Sdk"> |
|||
|
|||
<Import Project="..\..\..\..\common.props" /> |
|||
|
|||
<PropertyGroup> |
|||
<TargetFramework>net6.0</TargetFramework> |
|||
<RootNamespace>EShopOnAbp.OrderingService</RootNamespace> |
|||
</PropertyGroup> |
|||
|
|||
<ItemGroup> |
|||
<ProjectReference Include="..\..\src\EShopOnAbp.OrderingService.Application\EShopOnAbp.OrderingService.Application.csproj" /> |
|||
<ProjectReference Include="..\EShopOnAbp.OrderingService.Domain.Tests\EShopOnAbp.OrderingService.Domain.Tests.csproj" /> |
|||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.11.0" /> |
|||
</ItemGroup> |
|||
|
|||
</Project> |
|||
@ -0,0 +1,3 @@ |
|||
<Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd"> |
|||
<ConfigureAwait ContinueOnCapturedContext="false" /> |
|||
</Weavers> |
|||
@ -0,0 +1,30 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> |
|||
<!-- This file was generated by Fody. Manual changes to this file will be lost when your project is rebuilt. --> |
|||
<xs:element name="Weavers"> |
|||
<xs:complexType> |
|||
<xs:all> |
|||
<xs:element name="ConfigureAwait" minOccurs="0" maxOccurs="1"> |
|||
<xs:complexType> |
|||
<xs:attribute name="ContinueOnCapturedContext" type="xs:boolean" /> |
|||
</xs:complexType> |
|||
</xs:element> |
|||
</xs:all> |
|||
<xs:attribute name="VerifyAssembly" type="xs:boolean"> |
|||
<xs:annotation> |
|||
<xs:documentation>'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed.</xs:documentation> |
|||
</xs:annotation> |
|||
</xs:attribute> |
|||
<xs:attribute name="VerifyIgnoreCodes" type="xs:string"> |
|||
<xs:annotation> |
|||
<xs:documentation>A comma-separated list of error codes that can be safely ignored in assembly verification.</xs:documentation> |
|||
</xs:annotation> |
|||
</xs:attribute> |
|||
<xs:attribute name="GenerateXsd" type="xs:boolean"> |
|||
<xs:annotation> |
|||
<xs:documentation>'false' to turn off automatic generation of the XML Schema file.</xs:documentation> |
|||
</xs:annotation> |
|||
</xs:attribute> |
|||
</xs:complexType> |
|||
</xs:element> |
|||
</xs:schema> |
|||
@ -0,0 +1,10 @@ |
|||
namespace EShopOnAbp.OrderingService |
|||
{ |
|||
/* Inherit from this class for your application layer tests. |
|||
* See SampleAppService_Tests for example. |
|||
*/ |
|||
public abstract class OrderingServiceApplicationTestBase : OrderingServiceTestBase<OrderingServiceApplicationTestModule> |
|||
{ |
|||
|
|||
} |
|||
} |
|||
@ -0,0 +1,13 @@ |
|||
using Volo.Abp.Modularity; |
|||
|
|||
namespace EShopOnAbp.OrderingService |
|||
{ |
|||
[DependsOn( |
|||
typeof(OrderingServiceApplicationModule), |
|||
typeof(OrderingServiceDomainTestModule) |
|||
)] |
|||
public class OrderingServiceApplicationTestModule : AbpModule |
|||
{ |
|||
|
|||
} |
|||
} |
|||
@ -0,0 +1,15 @@ |
|||
<Project Sdk="Microsoft.NET.Sdk"> |
|||
|
|||
<Import Project="..\..\..\..\common.props" /> |
|||
|
|||
<PropertyGroup> |
|||
<TargetFramework>net6.0</TargetFramework> |
|||
<RootNamespace>EShopOnAbp.OrderingService</RootNamespace> |
|||
</PropertyGroup> |
|||
|
|||
<ItemGroup> |
|||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.11.0" /> |
|||
<ProjectReference Include="..\EShopOnAbp.OrderingService.EntityFrameworkCore.Tests\EShopOnAbp.OrderingService.EntityFrameworkCore.Tests.csproj" /> |
|||
</ItemGroup> |
|||
|
|||
</Project> |
|||
@ -0,0 +1,3 @@ |
|||
<Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd"> |
|||
<ConfigureAwait ContinueOnCapturedContext="false" /> |
|||
</Weavers> |
|||
@ -0,0 +1,30 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> |
|||
<!-- This file was generated by Fody. Manual changes to this file will be lost when your project is rebuilt. --> |
|||
<xs:element name="Weavers"> |
|||
<xs:complexType> |
|||
<xs:all> |
|||
<xs:element name="ConfigureAwait" minOccurs="0" maxOccurs="1"> |
|||
<xs:complexType> |
|||
<xs:attribute name="ContinueOnCapturedContext" type="xs:boolean" /> |
|||
</xs:complexType> |
|||
</xs:element> |
|||
</xs:all> |
|||
<xs:attribute name="VerifyAssembly" type="xs:boolean"> |
|||
<xs:annotation> |
|||
<xs:documentation>'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed.</xs:documentation> |
|||
</xs:annotation> |
|||
</xs:attribute> |
|||
<xs:attribute name="VerifyIgnoreCodes" type="xs:string"> |
|||
<xs:annotation> |
|||
<xs:documentation>A comma-separated list of error codes that can be safely ignored in assembly verification.</xs:documentation> |
|||
</xs:annotation> |
|||
</xs:attribute> |
|||
<xs:attribute name="GenerateXsd" type="xs:boolean"> |
|||
<xs:annotation> |
|||
<xs:documentation>'false' to turn off automatic generation of the XML Schema file.</xs:documentation> |
|||
</xs:annotation> |
|||
</xs:attribute> |
|||
</xs:complexType> |
|||
</xs:element> |
|||
</xs:schema> |
|||
@ -0,0 +1,10 @@ |
|||
namespace EShopOnAbp.OrderingService |
|||
{ |
|||
/* Inherit from this class for your domain layer tests. |
|||
* See SampleManager_Tests for example. |
|||
*/ |
|||
public abstract class OrderingServiceDomainTestBase : OrderingServiceTestBase<OrderingServiceDomainTestModule> |
|||
{ |
|||
|
|||
} |
|||
} |
|||
@ -0,0 +1,17 @@ |
|||
using EShopOnAbp.OrderingService.EntityFrameworkCore; |
|||
using Volo.Abp.Modularity; |
|||
|
|||
namespace EShopOnAbp.OrderingService |
|||
{ |
|||
/* Domain tests are configured to use the EF Core provider. |
|||
* You can switch to MongoDB, however your domain tests should be |
|||
* database independent anyway. |
|||
*/ |
|||
[DependsOn( |
|||
typeof(OrderingServiceEntityFrameworkCoreTestModule) |
|||
)] |
|||
public class OrderingServiceDomainTestModule : AbpModule |
|||
{ |
|||
|
|||
} |
|||
} |
|||
@ -0,0 +1,21 @@ |
|||
using System.Threading.Tasks; |
|||
using Xunit; |
|||
|
|||
namespace EShopOnAbp.OrderingService.Samples |
|||
{ |
|||
public class SampleManager_Tests : OrderingServiceDomainTestBase |
|||
{ |
|||
//private readonly SampleManager _sampleManager;
|
|||
|
|||
public SampleManager_Tests() |
|||
{ |
|||
//_sampleManager = GetRequiredService<SampleManager>();
|
|||
} |
|||
|
|||
[Fact] |
|||
public async Task Method1Async() |
|||
{ |
|||
|
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,18 @@ |
|||
<Project Sdk="Microsoft.NET.Sdk"> |
|||
|
|||
<Import Project="..\..\..\..\common.props" /> |
|||
|
|||
<PropertyGroup> |
|||
<TargetFramework>net6.0</TargetFramework> |
|||
<RootNamespace>EShopOnAbp.OrderingService</RootNamespace> |
|||
</PropertyGroup> |
|||
|
|||
<ItemGroup> |
|||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.11.0" /> |
|||
<PackageReference Include="Microsoft.EntityFrameworkCore.Proxies" Version="6.0.0-rc.*" /> |
|||
<ProjectReference Include="..\..\src\EShopOnAbp.OrderingService.EntityFrameworkCore\EShopOnAbp.OrderingService.EntityFrameworkCore.csproj" /> |
|||
<ProjectReference Include="..\EShopOnAbp.OrderingService.TestBase\EShopOnAbp.OrderingService.TestBase.csproj" /> |
|||
<PackageReference Include="Volo.Abp.EntityFrameworkCore.Sqlite" Version="5.0.0-beta.1" /> |
|||
</ItemGroup> |
|||
|
|||
</Project> |
|||
@ -0,0 +1,10 @@ |
|||
namespace EShopOnAbp.OrderingService.EntityFrameworkCore |
|||
{ |
|||
/* This class can be used as a base class for EF Core integration tests, |
|||
* while SampleRepository_Tests uses a different approach. |
|||
*/ |
|||
public abstract class OrderingServiceEntityFrameworkCoreTestBase : OrderingServiceTestBase<OrderingServiceEntityFrameworkCoreTestModule> |
|||
{ |
|||
|
|||
} |
|||
} |
|||
@ -0,0 +1,43 @@ |
|||
using Microsoft.Data.Sqlite; |
|||
using Microsoft.EntityFrameworkCore; |
|||
using Microsoft.EntityFrameworkCore.Infrastructure; |
|||
using Microsoft.EntityFrameworkCore.Storage; |
|||
using Volo.Abp.EntityFrameworkCore; |
|||
using Volo.Abp.EntityFrameworkCore.Sqlite; |
|||
using Volo.Abp.Modularity; |
|||
|
|||
namespace EShopOnAbp.OrderingService.EntityFrameworkCore |
|||
{ |
|||
[DependsOn( |
|||
typeof(OrderingServiceTestBaseModule), |
|||
typeof(OrderingServiceEntityFrameworkCoreModule), |
|||
typeof(AbpEntityFrameworkCoreSqliteModule) |
|||
)] |
|||
public class OrderingServiceEntityFrameworkCoreTestModule : AbpModule |
|||
{ |
|||
public override void ConfigureServices(ServiceConfigurationContext context) |
|||
{ |
|||
var sqliteConnection = CreateDatabaseAndGetConnection(); |
|||
|
|||
Configure<AbpDbContextOptions>(options => |
|||
{ |
|||
options.Configure(abpDbContextConfigurationContext => |
|||
{ |
|||
abpDbContextConfigurationContext.DbContextOptions.UseSqlite(sqliteConnection); |
|||
}); |
|||
}); |
|||
} |
|||
|
|||
private static SqliteConnection CreateDatabaseAndGetConnection() |
|||
{ |
|||
var connection = new SqliteConnection("Data Source=:memory:"); |
|||
connection.Open(); |
|||
|
|||
new OrderingServiceDbContext( |
|||
new DbContextOptionsBuilder<OrderingServiceDbContext>().UseSqlite(connection).Options |
|||
).GetService<IRelationalDatabaseCreator>().CreateTables(); |
|||
|
|||
return connection; |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,12 @@ |
|||
using EShopOnAbp.OrderingService.Samples; |
|||
|
|||
namespace EShopOnAbp.OrderingService.EntityFrameworkCore.Samples |
|||
{ |
|||
public class SampleRepository_Tests : SampleRepository_Tests<OrderingServiceEntityFrameworkCoreTestModule> |
|||
{ |
|||
/* Don't write custom repository tests here, instead write to |
|||
* the base class. |
|||
* One exception can be some specific tests related to EF core. |
|||
*/ |
|||
} |
|||
} |
|||
@ -0,0 +1,3 @@ |
|||
<Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd"> |
|||
<ConfigureAwait ContinueOnCapturedContext="false" /> |
|||
</Weavers> |
|||
@ -0,0 +1,30 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> |
|||
<!-- This file was generated by Fody. Manual changes to this file will be lost when your project is rebuilt. --> |
|||
<xs:element name="Weavers"> |
|||
<xs:complexType> |
|||
<xs:all> |
|||
<xs:element name="ConfigureAwait" minOccurs="0" maxOccurs="1"> |
|||
<xs:complexType> |
|||
<xs:attribute name="ContinueOnCapturedContext" type="xs:boolean" /> |
|||
</xs:complexType> |
|||
</xs:element> |
|||
</xs:all> |
|||
<xs:attribute name="VerifyAssembly" type="xs:boolean"> |
|||
<xs:annotation> |
|||
<xs:documentation>'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed.</xs:documentation> |
|||
</xs:annotation> |
|||
</xs:attribute> |
|||
<xs:attribute name="VerifyIgnoreCodes" type="xs:string"> |
|||
<xs:annotation> |
|||
<xs:documentation>A comma-separated list of error codes that can be safely ignored in assembly verification.</xs:documentation> |
|||
</xs:annotation> |
|||
</xs:attribute> |
|||
<xs:attribute name="GenerateXsd" type="xs:boolean"> |
|||
<xs:annotation> |
|||
<xs:documentation>'false' to turn off automatic generation of the XML Schema file.</xs:documentation> |
|||
</xs:annotation> |
|||
</xs:attribute> |
|||
</xs:complexType> |
|||
</xs:element> |
|||
</xs:schema> |
|||
@ -0,0 +1,147 @@ |
|||
using System; |
|||
using System.Net.Http; |
|||
using System.Threading.Tasks; |
|||
using IdentityModel.Client; |
|||
using Microsoft.Extensions.Configuration; |
|||
using EShopOnAbp.OrderingService.Samples; |
|||
using Volo.Abp.DependencyInjection; |
|||
using Volo.Abp.IdentityModel; |
|||
|
|||
namespace EShopOnAbp.OrderingService |
|||
{ |
|||
public class ClientDemoService : ITransientDependency |
|||
{ |
|||
private readonly IIdentityModelAuthenticationService _authenticationService; |
|||
private readonly IConfiguration _configuration; |
|||
|
|||
public ClientDemoService( |
|||
IIdentityModelAuthenticationService authenticationService, |
|||
IConfiguration configuration) |
|||
{ |
|||
_authenticationService = authenticationService; |
|||
_configuration = configuration; |
|||
} |
|||
|
|||
public async Task RunAsync() |
|||
{ |
|||
await TestWithDynamicProxiesAsync(); |
|||
await TestWithHttpClientAndIdentityModelAuthenticationServiceAsync(); |
|||
await TestAllManuallyAsync(); |
|||
} |
|||
|
|||
/* Shows how to perform an HTTP request to the API using ABP's dynamic c# proxy |
|||
* feature. It is just simple as calling a local service method. |
|||
* Authorization and HTTP request details are handled by the ABP framework. |
|||
*/ |
|||
private async Task TestWithDynamicProxiesAsync() |
|||
{ |
|||
Console.WriteLine(); |
|||
Console.WriteLine($"***** {nameof(TestWithDynamicProxiesAsync)} *****"); |
|||
} |
|||
|
|||
/* Shows how to use HttpClient to perform a request to the HTTP API. |
|||
* It uses ABP's IIdentityModelAuthenticationService to simplify obtaining access tokens. |
|||
*/ |
|||
private async Task TestWithHttpClientAndIdentityModelAuthenticationServiceAsync() |
|||
{ |
|||
Console.WriteLine(); |
|||
Console.WriteLine($"***** {nameof(TestWithHttpClientAndIdentityModelAuthenticationServiceAsync)} *****"); |
|||
|
|||
//Get access token using ABP's IIdentityModelAuthenticationService
|
|||
|
|||
var accessToken = await _authenticationService.GetAccessTokenAsync( |
|||
new IdentityClientConfiguration( |
|||
_configuration["IdentityClients:Default:Authority"], |
|||
_configuration["IdentityClients:Default:Scope"], |
|||
_configuration["IdentityClients:Default:ClientId"], |
|||
_configuration["IdentityClients:Default:ClientSecret"], |
|||
_configuration["IdentityClients:Default:GrantType"], |
|||
_configuration["IdentityClients:Default:UserName"], |
|||
_configuration["IdentityClients:Default:UserPassword"] |
|||
) |
|||
); |
|||
|
|||
//Perform the actual HTTP request
|
|||
|
|||
using (var httpClient = new HttpClient()) |
|||
{ |
|||
httpClient.SetBearerToken(accessToken); |
|||
|
|||
var url = _configuration["RemoteServices:OrderingService:BaseUrl"] + |
|||
"api/OrderingService/sample/authorized"; |
|||
|
|||
var responseMessage = await httpClient.GetAsync(url); |
|||
if (responseMessage.IsSuccessStatusCode) |
|||
{ |
|||
var responseString = await responseMessage.Content.ReadAsStringAsync(); |
|||
Console.WriteLine("Result: " + responseString); |
|||
} |
|||
else |
|||
{ |
|||
throw new Exception("Remote server returns error code: " + responseMessage.StatusCode); |
|||
} |
|||
} |
|||
} |
|||
|
|||
/* Shows how to use HttpClient to perform a request to the HTTP API. |
|||
* It obtains access token using IdentityServer's API. See its documentation: |
|||
* https://identityserver4.readthedocs.io/en/latest/quickstarts/2_resource_owner_passwords.html
|
|||
*/ |
|||
private async Task TestAllManuallyAsync() |
|||
{ |
|||
Console.WriteLine(); |
|||
Console.WriteLine($"***** {nameof(TestAllManuallyAsync)} *****"); |
|||
|
|||
//Obtain access token from the IDS4 server
|
|||
|
|||
// discover endpoints from metadata
|
|||
var client = new HttpClient(); |
|||
var disco = await client.GetDiscoveryDocumentAsync(_configuration["IdentityClients:Default:Authority"]); |
|||
if (disco.IsError) |
|||
{ |
|||
Console.WriteLine(disco.Error); |
|||
return; |
|||
} |
|||
|
|||
// request token
|
|||
var tokenResponse = await client.RequestPasswordTokenAsync(new PasswordTokenRequest |
|||
{ |
|||
Address = disco.TokenEndpoint, |
|||
ClientId = _configuration["IdentityClients:Default:ClientId"], |
|||
ClientSecret = _configuration["IdentityClients:Default:ClientSecret"], |
|||
UserName = _configuration["IdentityClients:Default:UserName"], |
|||
Password = _configuration["IdentityClients:Default:UserPassword"], |
|||
Scope = _configuration["IdentityClients:Default:Scope"] |
|||
}); |
|||
|
|||
if (tokenResponse.IsError) |
|||
{ |
|||
Console.WriteLine(tokenResponse.Error); |
|||
return; |
|||
} |
|||
|
|||
Console.WriteLine(tokenResponse.Json); |
|||
|
|||
//Perform the actual HTTP request
|
|||
|
|||
using (var httpClient = new HttpClient()) |
|||
{ |
|||
httpClient.SetBearerToken(tokenResponse.AccessToken); |
|||
|
|||
var url = _configuration["RemoteServices:OrderingService:BaseUrl"] + |
|||
"api/OrderingService/sample/authorized"; |
|||
|
|||
var responseMessage = await httpClient.GetAsync(url); |
|||
if (responseMessage.IsSuccessStatusCode) |
|||
{ |
|||
var responseString = await responseMessage.Content.ReadAsStringAsync(); |
|||
Console.WriteLine("Result: " + responseString); |
|||
} |
|||
else |
|||
{ |
|||
throw new Exception("Remote server returns error code: " + responseMessage.StatusCode); |
|||
} |
|||
} |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,37 @@ |
|||
using Microsoft.Extensions.Hosting; |
|||
using System.Threading; |
|||
using System.Threading.Tasks; |
|||
using Microsoft.Extensions.Configuration; |
|||
using Microsoft.Extensions.DependencyInjection; |
|||
using Volo.Abp; |
|||
|
|||
namespace EShopOnAbp.OrderingService.HttpApi.Client.ConsoleTestApp |
|||
{ |
|||
public class ConsoleTestAppHostedService : IHostedService |
|||
{ |
|||
private readonly IConfiguration _configuration; |
|||
|
|||
public ConsoleTestAppHostedService(IConfiguration configuration) |
|||
{ |
|||
_configuration = configuration; |
|||
} |
|||
|
|||
public async Task StartAsync(CancellationToken cancellationToken) |
|||
{ |
|||
using (var application = AbpApplicationFactory.Create<OrderingServiceConsoleApiClientModule>(options=> |
|||
{ |
|||
options.Services.ReplaceConfiguration(_configuration); |
|||
})) |
|||
{ |
|||
application.Initialize(); |
|||
|
|||
var demo = application.ServiceProvider.GetRequiredService<ClientDemoService>(); |
|||
await demo.RunAsync(); |
|||
|
|||
application.Shutdown(); |
|||
} |
|||
} |
|||
|
|||
public Task StopAsync(CancellationToken cancellationToken) => Task.CompletedTask; |
|||
} |
|||
} |
|||
@ -0,0 +1,31 @@ |
|||
<Project Sdk="Microsoft.NET.Sdk"> |
|||
|
|||
<PropertyGroup> |
|||
<OutputType>Exe</OutputType> |
|||
<TargetFramework>net6.0</TargetFramework> |
|||
<RootNamespace>EShopOnAbp.OrderingService</RootNamespace> |
|||
</PropertyGroup> |
|||
|
|||
<ItemGroup> |
|||
<PackageReference Include="Volo.Abp.Http.Client.IdentityModel" Version="5.0.0-beta.1" /> |
|||
<ProjectReference Include="..\..\src\EShopOnAbp.OrderingService.HttpApi.Client\EShopOnAbp.OrderingService.HttpApi.Client.csproj" /> |
|||
</ItemGroup> |
|||
|
|||
<ItemGroup> |
|||
<None Remove="appsettings.json" /> |
|||
<Content Include="appsettings.json"> |
|||
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory> |
|||
<CopyToOutputDirectory>Always</CopyToOutputDirectory> |
|||
</Content> |
|||
<None Remove="appsettings.secrets.json" /> |
|||
<Content Include="appsettings.secrets.json"> |
|||
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory> |
|||
<CopyToOutputDirectory>Always</CopyToOutputDirectory> |
|||
</Content> |
|||
</ItemGroup> |
|||
|
|||
<ItemGroup> |
|||
<PackageReference Include="Microsoft.Extensions.Hosting" Version="6.0.0-rc.*" /> |
|||
</ItemGroup> |
|||
|
|||
</Project> |
|||
@ -0,0 +1,14 @@ |
|||
using Volo.Abp.Http.Client.IdentityModel; |
|||
using Volo.Abp.Modularity; |
|||
|
|||
namespace EShopOnAbp.OrderingService |
|||
{ |
|||
[DependsOn( |
|||
typeof(OrderingServiceHttpApiClientModule), |
|||
typeof(AbpHttpClientIdentityModelModule) |
|||
)] |
|||
public class OrderingServiceConsoleApiClientModule : AbpModule |
|||
{ |
|||
|
|||
} |
|||
} |
|||
@ -0,0 +1,23 @@ |
|||
using System.Threading.Tasks; |
|||
using Microsoft.Extensions.Configuration; |
|||
using Microsoft.Extensions.DependencyInjection; |
|||
using Microsoft.Extensions.Hosting; |
|||
|
|||
namespace EShopOnAbp.OrderingService.HttpApi.Client.ConsoleTestApp |
|||
{ |
|||
class Program |
|||
{ |
|||
static async Task Main(string[] args) |
|||
{ |
|||
await CreateHostBuilder(args).RunConsoleAsync(); |
|||
} |
|||
|
|||
public static IHostBuilder CreateHostBuilder(string[] args) => |
|||
Host.CreateDefaultBuilder(args) |
|||
.AddAppSettingsSecretsJson() |
|||
.ConfigureServices((hostContext, services) => |
|||
{ |
|||
services.AddHostedService<ConsoleTestAppHostedService>(); |
|||
}); |
|||
} |
|||
} |
|||
@ -0,0 +1,21 @@ |
|||
{ |
|||
"RemoteServices": { |
|||
"Default": { |
|||
"BaseUrl": "https://localhost:44333/" |
|||
}, |
|||
"OrderingService": { |
|||
"BaseUrl": "https://localhost:44380/" |
|||
} |
|||
}, |
|||
"IdentityClients": { |
|||
"Default": { |
|||
"GrantType": "password", |
|||
"ClientId": "OrderingService_App", |
|||
"ClientSecret": "1q2w3e*", |
|||
"UserName": "admin", |
|||
"UserPassword": "1q2w3E*", |
|||
"Authority": "https://localhost:44333/", |
|||
"Scope": "OrderingService" |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,2 @@ |
|||
{ |
|||
} |
|||
@ -0,0 +1,23 @@ |
|||
<Project Sdk="Microsoft.NET.Sdk"> |
|||
|
|||
<Import Project="..\..\..\..\common.props" /> |
|||
|
|||
<PropertyGroup> |
|||
<TargetFramework>net6.0</TargetFramework> |
|||
<RootNamespace>EShopOnAbp.OrderingService</RootNamespace> |
|||
</PropertyGroup> |
|||
|
|||
<ItemGroup> |
|||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.11.0" /> |
|||
<PackageReference Include="NSubstitute" Version="4.2.2" /> |
|||
<PackageReference Include="Shouldly" Version="4.0.3" /> |
|||
<PackageReference Include="xunit" Version="2.4.1" /> |
|||
<PackageReference Include="xunit.extensibility.execution" Version="2.4.1" /> |
|||
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3" /> |
|||
<PackageReference Include="Volo.Abp.Autofac" Version="5.0.0-beta.1" /> |
|||
<PackageReference Include="Volo.Abp.Authorization" Version="5.0.0-beta.1" /> |
|||
<PackageReference Include="Volo.Abp.TestBase" Version="5.0.0-beta.1" /> |
|||
<ProjectReference Include="..\..\src\EShopOnAbp.OrderingService.Domain\EShopOnAbp.OrderingService.Domain.csproj" /> |
|||
</ItemGroup> |
|||
|
|||
</Project> |
|||
@ -0,0 +1,3 @@ |
|||
<Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd"> |
|||
<ConfigureAwait ContinueOnCapturedContext="false" /> |
|||
</Weavers> |
|||
@ -0,0 +1,30 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> |
|||
<!-- This file was generated by Fody. Manual changes to this file will be lost when your project is rebuilt. --> |
|||
<xs:element name="Weavers"> |
|||
<xs:complexType> |
|||
<xs:all> |
|||
<xs:element name="ConfigureAwait" minOccurs="0" maxOccurs="1"> |
|||
<xs:complexType> |
|||
<xs:attribute name="ContinueOnCapturedContext" type="xs:boolean" /> |
|||
</xs:complexType> |
|||
</xs:element> |
|||
</xs:all> |
|||
<xs:attribute name="VerifyAssembly" type="xs:boolean"> |
|||
<xs:annotation> |
|||
<xs:documentation>'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed.</xs:documentation> |
|||
</xs:annotation> |
|||
</xs:attribute> |
|||
<xs:attribute name="VerifyIgnoreCodes" type="xs:string"> |
|||
<xs:annotation> |
|||
<xs:documentation>A comma-separated list of error codes that can be safely ignored in assembly verification.</xs:documentation> |
|||
</xs:annotation> |
|||
</xs:attribute> |
|||
<xs:attribute name="GenerateXsd" type="xs:boolean"> |
|||
<xs:annotation> |
|||
<xs:documentation>'false' to turn off automatic generation of the XML Schema file.</xs:documentation> |
|||
</xs:annotation> |
|||
</xs:attribute> |
|||
</xs:complexType> |
|||
</xs:element> |
|||
</xs:schema> |
|||
@ -0,0 +1,33 @@ |
|||
using System.Threading.Tasks; |
|||
using Volo.Abp.Data; |
|||
using Volo.Abp.DependencyInjection; |
|||
using Volo.Abp.Guids; |
|||
using Volo.Abp.MultiTenancy; |
|||
|
|||
namespace EShopOnAbp.OrderingService |
|||
{ |
|||
public class OrderingServiceDataSeedContributor : IDataSeedContributor, ITransientDependency |
|||
{ |
|||
private readonly IGuidGenerator _guidGenerator; |
|||
private readonly ICurrentTenant _currentTenant; |
|||
|
|||
public OrderingServiceDataSeedContributor( |
|||
IGuidGenerator guidGenerator, ICurrentTenant currentTenant) |
|||
{ |
|||
_guidGenerator = guidGenerator; |
|||
_currentTenant = currentTenant; |
|||
} |
|||
|
|||
public Task SeedAsync(DataSeedContext context) |
|||
{ |
|||
/* Instead of returning the Task.CompletedTask, you can insert your test data |
|||
* at this point! |
|||
*/ |
|||
|
|||
using (_currentTenant.Change(context?.TenantId)) |
|||
{ |
|||
return Task.CompletedTask; |
|||
} |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,60 @@ |
|||
using System; |
|||
using System.Threading.Tasks; |
|||
using Microsoft.Extensions.DependencyInjection; |
|||
using Volo.Abp; |
|||
using Volo.Abp.Modularity; |
|||
using Volo.Abp.Uow; |
|||
using Volo.Abp.Testing; |
|||
|
|||
namespace EShopOnAbp.OrderingService |
|||
{ |
|||
/* All test classes are derived from this class, directly or indirectly. */ |
|||
public abstract class OrderingServiceTestBase<TStartupModule> : AbpIntegratedTest<TStartupModule> |
|||
where TStartupModule : IAbpModule |
|||
{ |
|||
protected override void SetAbpApplicationCreationOptions(AbpApplicationCreationOptions options) |
|||
{ |
|||
options.UseAutofac(); |
|||
} |
|||
|
|||
protected virtual Task WithUnitOfWorkAsync(Func<Task> func) |
|||
{ |
|||
return WithUnitOfWorkAsync(new AbpUnitOfWorkOptions(), func); |
|||
} |
|||
|
|||
protected virtual async Task WithUnitOfWorkAsync(AbpUnitOfWorkOptions options, Func<Task> action) |
|||
{ |
|||
using (var scope = ServiceProvider.CreateScope()) |
|||
{ |
|||
var uowManager = scope.ServiceProvider.GetRequiredService<IUnitOfWorkManager>(); |
|||
|
|||
using (var uow = uowManager.Begin(options)) |
|||
{ |
|||
await action(); |
|||
|
|||
await uow.CompleteAsync(); |
|||
} |
|||
} |
|||
} |
|||
|
|||
protected virtual Task<TResult> WithUnitOfWorkAsync<TResult>(Func<Task<TResult>> func) |
|||
{ |
|||
return WithUnitOfWorkAsync(new AbpUnitOfWorkOptions(), func); |
|||
} |
|||
|
|||
protected virtual async Task<TResult> WithUnitOfWorkAsync<TResult>(AbpUnitOfWorkOptions options, Func<Task<TResult>> func) |
|||
{ |
|||
using (var scope = ServiceProvider.CreateScope()) |
|||
{ |
|||
var uowManager = scope.ServiceProvider.GetRequiredService<IUnitOfWorkManager>(); |
|||
|
|||
using (var uow = uowManager.Begin(options)) |
|||
{ |
|||
var result = await func(); |
|||
await uow.CompleteAsync(); |
|||
return result; |
|||
} |
|||
} |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,42 @@ |
|||
using Microsoft.Extensions.DependencyInjection; |
|||
using Volo.Abp; |
|||
using Volo.Abp.Authorization; |
|||
using Volo.Abp.Autofac; |
|||
using Volo.Abp.Data; |
|||
using Volo.Abp.Modularity; |
|||
using Volo.Abp.Threading; |
|||
|
|||
namespace EShopOnAbp.OrderingService |
|||
{ |
|||
[DependsOn( |
|||
typeof(AbpAutofacModule), |
|||
typeof(AbpTestBaseModule), |
|||
typeof(AbpAuthorizationModule), |
|||
typeof(OrderingServiceDomainModule) |
|||
)] |
|||
public class OrderingServiceTestBaseModule : AbpModule |
|||
{ |
|||
public override void ConfigureServices(ServiceConfigurationContext context) |
|||
{ |
|||
context.Services.AddAlwaysAllowAuthorization(); |
|||
} |
|||
|
|||
public override void OnApplicationInitialization(ApplicationInitializationContext context) |
|||
{ |
|||
SeedTestData(context); |
|||
} |
|||
|
|||
private static void SeedTestData(ApplicationInitializationContext context) |
|||
{ |
|||
AsyncHelper.RunSync(async () => |
|||
{ |
|||
using (var scope = context.ServiceProvider.CreateScope()) |
|||
{ |
|||
await scope.ServiceProvider |
|||
.GetRequiredService<IDataSeeder>() |
|||
.SeedAsync(); |
|||
} |
|||
}); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,27 @@ |
|||
using System.Threading.Tasks; |
|||
using Volo.Abp.Modularity; |
|||
using Xunit; |
|||
|
|||
namespace EShopOnAbp.OrderingService.Samples |
|||
{ |
|||
/* Write your custom repository tests like that, in this project, as abstract classes. |
|||
* Then inherit these abstract classes from EF Core & MongoDB test projects. |
|||
* In this way, both database providers are tests with the same set tests. |
|||
*/ |
|||
public abstract class SampleRepository_Tests<TStartupModule> : OrderingServiceTestBase<TStartupModule> |
|||
where TStartupModule : IAbpModule |
|||
{ |
|||
//private readonly ISampleRepository _sampleRepository;
|
|||
|
|||
protected SampleRepository_Tests() |
|||
{ |
|||
//_sampleRepository = GetRequiredService<ISampleRepository>();
|
|||
} |
|||
|
|||
[Fact] |
|||
public async Task Method1Async() |
|||
{ |
|||
|
|||
} |
|||
} |
|||
} |
|||
Some files were not shown because too many files changed in this diff
Loading…
Reference in new issue