78 changed files with 1547 additions and 0 deletions
@ -0,0 +1,109 @@ |
|||
|
|||
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.BasketService.Domain", "src\EShopOnAbp.BasketService.Domain\EShopOnAbp.BasketService.Domain.csproj", "{554AD327-6DBA-4F8F-96F8-81CE7A0C863F}" |
|||
EndProject |
|||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EShopOnAbp.BasketService.Application", "src\EShopOnAbp.BasketService.Application\EShopOnAbp.BasketService.Application.csproj", "{1A94A50E-06DC-43C1-80B5-B662820EC3EB}" |
|||
EndProject |
|||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{CA9AC87F-097E-4F15-8393-4BC07735A5B0}" |
|||
EndProject |
|||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{04DBDB01-70F4-4E06-B468-8F87850B22BE}" |
|||
EndProject |
|||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EShopOnAbp.BasketService.Application.Tests", "test\EShopOnAbp.BasketService.Application.Tests\EShopOnAbp.BasketService.Application.Tests.csproj", "{50B2631D-129C-47B3-A587-029CCD6099BC}" |
|||
EndProject |
|||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EShopOnAbp.BasketService.Domain.Shared", "src\EShopOnAbp.BasketService.Domain.Shared\EShopOnAbp.BasketService.Domain.Shared.csproj", "{42F719ED-8413-4895-B5B4-5AB56079BC66}" |
|||
EndProject |
|||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EShopOnAbp.BasketService.Application.Contracts", "src\EShopOnAbp.BasketService.Application.Contracts\EShopOnAbp.BasketService.Application.Contracts.csproj", "{520659C8-C734-4298-A3DA-B539DB9DFC0B}" |
|||
EndProject |
|||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EShopOnAbp.BasketService.HttpApi", "src\EShopOnAbp.BasketService.HttpApi\EShopOnAbp.BasketService.HttpApi.csproj", "{4164BDF7-F527-4E85-9CE6-E3C2D7426A27}" |
|||
EndProject |
|||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EShopOnAbp.BasketService.HttpApi.Client", "src\EShopOnAbp.BasketService.HttpApi.Client\EShopOnAbp.BasketService.HttpApi.Client.csproj", "{3B5A0094-670D-4BB1-BFDD-61B88A8773DC}" |
|||
EndProject |
|||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EShopOnAbp.BasketService.EntityFrameworkCore.Tests", "test\EShopOnAbp.BasketService.EntityFrameworkCore.Tests\EShopOnAbp.BasketService.EntityFrameworkCore.Tests.csproj", "{1FE30EB9-74A9-47F5-A9F6-7B1FAB672D81}" |
|||
EndProject |
|||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EShopOnAbp.BasketService.TestBase", "test\EShopOnAbp.BasketService.TestBase\EShopOnAbp.BasketService.TestBase.csproj", "{91853F21-9CD9-4132-BC29-A7D5D84FFFE7}" |
|||
EndProject |
|||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EShopOnAbp.BasketService.Domain.Tests", "test\EShopOnAbp.BasketService.Domain.Tests\EShopOnAbp.BasketService.Domain.Tests.csproj", "{E512F4D9-9375-480F-A2F6-A46509F9D824}" |
|||
EndProject |
|||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EShopOnAbp.BasketService.HttpApi.Client.ConsoleTestApp", "test\EShopOnAbp.BasketService.HttpApi.Client.ConsoleTestApp\EShopOnAbp.BasketService.HttpApi.Client.ConsoleTestApp.csproj", "{EF480016-9127-4916-8735-D2466BDBC582}" |
|||
EndProject |
|||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EShopOnAbp.BasketService.HttpApi.Host", "src\EShopOnAbp.BasketService.HttpApi.Host\EShopOnAbp.BasketService.HttpApi.Host.csproj", "{748584B1-BA69-4F6A-81AA-F4BDE6BCE29D}" |
|||
EndProject |
|||
Global |
|||
GlobalSection(SolutionConfigurationPlatforms) = preSolution |
|||
Debug|Any CPU = Debug|Any CPU |
|||
Release|Any CPU = Release|Any CPU |
|||
EndGlobalSection |
|||
GlobalSection(ProjectConfigurationPlatforms) = postSolution |
|||
{554AD327-6DBA-4F8F-96F8-81CE7A0C863F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU |
|||
{554AD327-6DBA-4F8F-96F8-81CE7A0C863F}.Debug|Any CPU.Build.0 = Debug|Any CPU |
|||
{554AD327-6DBA-4F8F-96F8-81CE7A0C863F}.Release|Any CPU.ActiveCfg = Release|Any CPU |
|||
{554AD327-6DBA-4F8F-96F8-81CE7A0C863F}.Release|Any CPU.Build.0 = Release|Any CPU |
|||
{1A94A50E-06DC-43C1-80B5-B662820EC3EB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU |
|||
{1A94A50E-06DC-43C1-80B5-B662820EC3EB}.Debug|Any CPU.Build.0 = Debug|Any CPU |
|||
{1A94A50E-06DC-43C1-80B5-B662820EC3EB}.Release|Any CPU.ActiveCfg = Release|Any CPU |
|||
{1A94A50E-06DC-43C1-80B5-B662820EC3EB}.Release|Any CPU.Build.0 = Release|Any CPU |
|||
{50B2631D-129C-47B3-A587-029CCD6099BC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU |
|||
{50B2631D-129C-47B3-A587-029CCD6099BC}.Debug|Any CPU.Build.0 = Debug|Any CPU |
|||
{50B2631D-129C-47B3-A587-029CCD6099BC}.Release|Any CPU.ActiveCfg = Release|Any CPU |
|||
{50B2631D-129C-47B3-A587-029CCD6099BC}.Release|Any CPU.Build.0 = Release|Any CPU |
|||
{42F719ED-8413-4895-B5B4-5AB56079BC66}.Debug|Any CPU.ActiveCfg = Debug|Any CPU |
|||
{42F719ED-8413-4895-B5B4-5AB56079BC66}.Debug|Any CPU.Build.0 = Debug|Any CPU |
|||
{42F719ED-8413-4895-B5B4-5AB56079BC66}.Release|Any CPU.ActiveCfg = Release|Any CPU |
|||
{42F719ED-8413-4895-B5B4-5AB56079BC66}.Release|Any CPU.Build.0 = Release|Any CPU |
|||
{520659C8-C734-4298-A3DA-B539DB9DFC0B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU |
|||
{520659C8-C734-4298-A3DA-B539DB9DFC0B}.Debug|Any CPU.Build.0 = Debug|Any CPU |
|||
{520659C8-C734-4298-A3DA-B539DB9DFC0B}.Release|Any CPU.ActiveCfg = Release|Any CPU |
|||
{520659C8-C734-4298-A3DA-B539DB9DFC0B}.Release|Any CPU.Build.0 = Release|Any CPU |
|||
{4164BDF7-F527-4E85-9CE6-E3C2D7426A27}.Debug|Any CPU.ActiveCfg = Debug|Any CPU |
|||
{4164BDF7-F527-4E85-9CE6-E3C2D7426A27}.Debug|Any CPU.Build.0 = Debug|Any CPU |
|||
{4164BDF7-F527-4E85-9CE6-E3C2D7426A27}.Release|Any CPU.ActiveCfg = Release|Any CPU |
|||
{4164BDF7-F527-4E85-9CE6-E3C2D7426A27}.Release|Any CPU.Build.0 = Release|Any CPU |
|||
{3B5A0094-670D-4BB1-BFDD-61B88A8773DC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU |
|||
{3B5A0094-670D-4BB1-BFDD-61B88A8773DC}.Debug|Any CPU.Build.0 = Debug|Any CPU |
|||
{3B5A0094-670D-4BB1-BFDD-61B88A8773DC}.Release|Any CPU.ActiveCfg = Release|Any CPU |
|||
{3B5A0094-670D-4BB1-BFDD-61B88A8773DC}.Release|Any CPU.Build.0 = Release|Any CPU |
|||
{1FE30EB9-74A9-47F5-A9F6-7B1FAB672D81}.Debug|Any CPU.ActiveCfg = Debug|Any CPU |
|||
{1FE30EB9-74A9-47F5-A9F6-7B1FAB672D81}.Debug|Any CPU.Build.0 = Debug|Any CPU |
|||
{1FE30EB9-74A9-47F5-A9F6-7B1FAB672D81}.Release|Any CPU.ActiveCfg = Release|Any CPU |
|||
{1FE30EB9-74A9-47F5-A9F6-7B1FAB672D81}.Release|Any CPU.Build.0 = Release|Any CPU |
|||
{91853F21-9CD9-4132-BC29-A7D5D84FFFE7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU |
|||
{91853F21-9CD9-4132-BC29-A7D5D84FFFE7}.Debug|Any CPU.Build.0 = Debug|Any CPU |
|||
{91853F21-9CD9-4132-BC29-A7D5D84FFFE7}.Release|Any CPU.ActiveCfg = Release|Any CPU |
|||
{91853F21-9CD9-4132-BC29-A7D5D84FFFE7}.Release|Any CPU.Build.0 = Release|Any CPU |
|||
{E512F4D9-9375-480F-A2F6-A46509F9D824}.Debug|Any CPU.ActiveCfg = Debug|Any CPU |
|||
{E512F4D9-9375-480F-A2F6-A46509F9D824}.Debug|Any CPU.Build.0 = Debug|Any CPU |
|||
{E512F4D9-9375-480F-A2F6-A46509F9D824}.Release|Any CPU.ActiveCfg = Release|Any CPU |
|||
{E512F4D9-9375-480F-A2F6-A46509F9D824}.Release|Any CPU.Build.0 = Release|Any CPU |
|||
{EF480016-9127-4916-8735-D2466BDBC582}.Debug|Any CPU.ActiveCfg = Debug|Any CPU |
|||
{EF480016-9127-4916-8735-D2466BDBC582}.Debug|Any CPU.Build.0 = Debug|Any CPU |
|||
{EF480016-9127-4916-8735-D2466BDBC582}.Release|Any CPU.ActiveCfg = Release|Any CPU |
|||
{EF480016-9127-4916-8735-D2466BDBC582}.Release|Any CPU.Build.0 = Release|Any CPU |
|||
{748584B1-BA69-4F6A-81AA-F4BDE6BCE29D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU |
|||
{748584B1-BA69-4F6A-81AA-F4BDE6BCE29D}.Debug|Any CPU.Build.0 = Debug|Any CPU |
|||
{748584B1-BA69-4F6A-81AA-F4BDE6BCE29D}.Release|Any CPU.ActiveCfg = Release|Any CPU |
|||
{748584B1-BA69-4F6A-81AA-F4BDE6BCE29D}.Release|Any CPU.Build.0 = Release|Any CPU |
|||
EndGlobalSection |
|||
GlobalSection(SolutionProperties) = preSolution |
|||
HideSolutionNode = FALSE |
|||
EndGlobalSection |
|||
GlobalSection(NestedProjects) = preSolution |
|||
{554AD327-6DBA-4F8F-96F8-81CE7A0C863F} = {CA9AC87F-097E-4F15-8393-4BC07735A5B0} |
|||
{1A94A50E-06DC-43C1-80B5-B662820EC3EB} = {CA9AC87F-097E-4F15-8393-4BC07735A5B0} |
|||
{50B2631D-129C-47B3-A587-029CCD6099BC} = {04DBDB01-70F4-4E06-B468-8F87850B22BE} |
|||
{42F719ED-8413-4895-B5B4-5AB56079BC66} = {CA9AC87F-097E-4F15-8393-4BC07735A5B0} |
|||
{520659C8-C734-4298-A3DA-B539DB9DFC0B} = {CA9AC87F-097E-4F15-8393-4BC07735A5B0} |
|||
{4164BDF7-F527-4E85-9CE6-E3C2D7426A27} = {CA9AC87F-097E-4F15-8393-4BC07735A5B0} |
|||
{3B5A0094-670D-4BB1-BFDD-61B88A8773DC} = {CA9AC87F-097E-4F15-8393-4BC07735A5B0} |
|||
{1FE30EB9-74A9-47F5-A9F6-7B1FAB672D81} = {04DBDB01-70F4-4E06-B468-8F87850B22BE} |
|||
{91853F21-9CD9-4132-BC29-A7D5D84FFFE7} = {04DBDB01-70F4-4E06-B468-8F87850B22BE} |
|||
{E512F4D9-9375-480F-A2F6-A46509F9D824} = {04DBDB01-70F4-4E06-B468-8F87850B22BE} |
|||
{EF480016-9127-4916-8735-D2466BDBC582} = {04DBDB01-70F4-4E06-B468-8F87850B22BE} |
|||
{748584B1-BA69-4F6A-81AA-F4BDE6BCE29D} = {CA9AC87F-097E-4F15-8393-4BC07735A5B0} |
|||
EndGlobalSection |
|||
GlobalSection(ExtensibilityGlobals) = postSolution |
|||
SolutionGuid = {6AAFA1C6-603E-13FA-45E5-7910AA9F661D} |
|||
EndGlobalSection |
|||
EndGlobal |
|||
@ -0,0 +1,21 @@ |
|||
using Volo.Abp.Application; |
|||
using Volo.Abp.Authorization; |
|||
using Volo.Abp.Modularity; |
|||
using Volo.Abp.ObjectExtending; |
|||
|
|||
namespace EShopOnAbp.BasketService |
|||
{ |
|||
[DependsOn( |
|||
typeof(BasketServiceDomainSharedModule), |
|||
typeof(AbpDddApplicationContractsModule), |
|||
typeof(AbpAuthorizationModule), |
|||
typeof(AbpObjectExtendingModule) |
|||
)] |
|||
public class BasketServiceApplicationContractsModule : AbpModule |
|||
{ |
|||
public override void PreConfigureServices(ServiceConfigurationContext context) |
|||
{ |
|||
BasketServiceDtoExtensions.Configure(); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,27 @@ |
|||
using Volo.Abp.Threading; |
|||
|
|||
namespace EShopOnAbp.BasketService |
|||
{ |
|||
public static class BasketServiceDtoExtensions |
|||
{ |
|||
private static readonly OneTimeRunner OneTimeRunner = new OneTimeRunner(); |
|||
|
|||
public static void Configure() |
|||
{ |
|||
OneTimeRunner.Run(() => |
|||
{ |
|||
/* You can add extension properties to DTOs |
|||
* defined in the depended modules. |
|||
* |
|||
* Example: |
|||
* |
|||
* ObjectExtensionManager.Instance |
|||
* .AddOrUpdateProperty<IdentityRoleDto, string>("Title"); |
|||
* |
|||
* See the documentation for more: |
|||
* https://docs.abp.io/en/abp/latest/Object-Extensions
|
|||
*/ |
|||
}); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,19 @@ |
|||
<Project Sdk="Microsoft.NET.Sdk"> |
|||
|
|||
<Import Project="..\..\..\..\common.props" /> |
|||
|
|||
<PropertyGroup> |
|||
<TargetFramework>netstandard2.0</TargetFramework> |
|||
<RootNamespace>EShopOnAbp.BasketService</RootNamespace> |
|||
</PropertyGroup> |
|||
|
|||
<ItemGroup> |
|||
<ProjectReference Include="..\EShopOnAbp.BasketService.Domain.Shared\EShopOnAbp.BasketService.Domain.Shared.csproj" /> |
|||
</ItemGroup> |
|||
|
|||
<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" /> |
|||
</ItemGroup> |
|||
|
|||
</Project> |
|||
@ -0,0 +1,21 @@ |
|||
using EShopOnAbp.BasketService.Localization; |
|||
using Volo.Abp.Authorization.Permissions; |
|||
using Volo.Abp.Localization; |
|||
|
|||
namespace EShopOnAbp.BasketService.Permissions |
|||
{ |
|||
public class BasketServicePermissionDefinitionProvider : PermissionDefinitionProvider |
|||
{ |
|||
public override void Define(IPermissionDefinitionContext context) |
|||
{ |
|||
var myGroup = context.AddGroup(BasketServicePermissions.GroupName); |
|||
//Define your own permissions here. Example:
|
|||
//myGroup.AddPermission(BasketServicePermissions.MyPermission1, L("Permission:MyPermission1"));
|
|||
} |
|||
|
|||
private static LocalizableString L(string name) |
|||
{ |
|||
return LocalizableString.Create<BasketServiceResource>(name); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,10 @@ |
|||
namespace EShopOnAbp.BasketService.Permissions |
|||
{ |
|||
public static class BasketServicePermissions |
|||
{ |
|||
public const string GroupName = "BasketService"; |
|||
|
|||
//Add your own permission names. Example:
|
|||
//public const string MyPermission1 = GroupName + ".MyPermission1";
|
|||
} |
|||
} |
|||
@ -0,0 +1,18 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Text; |
|||
using EShopOnAbp.BasketService.Localization; |
|||
using Volo.Abp.Application.Services; |
|||
|
|||
namespace EShopOnAbp.BasketService |
|||
{ |
|||
/* Inherit your application services from this class. |
|||
*/ |
|||
public abstract class BasketServiceAppService : ApplicationService |
|||
{ |
|||
protected BasketServiceAppService() |
|||
{ |
|||
LocalizationResource = typeof(BasketServiceResource); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,14 @@ |
|||
using AutoMapper; |
|||
|
|||
namespace EShopOnAbp.BasketService |
|||
{ |
|||
public class BasketServiceApplicationAutoMapperProfile : Profile |
|||
{ |
|||
public BasketServiceApplicationAutoMapperProfile() |
|||
{ |
|||
/* 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,23 @@ |
|||
using Volo.Abp.Application; |
|||
using Volo.Abp.AutoMapper; |
|||
using Volo.Abp.Modularity; |
|||
|
|||
namespace EShopOnAbp.BasketService |
|||
{ |
|||
[DependsOn( |
|||
typeof(BasketServiceDomainModule), |
|||
typeof(BasketServiceApplicationContractsModule), |
|||
typeof(AbpDddApplicationModule), |
|||
typeof(AbpAutoMapperModule) |
|||
)] |
|||
public class BasketServiceApplicationModule : AbpModule |
|||
{ |
|||
public override void ConfigureServices(ServiceConfigurationContext context) |
|||
{ |
|||
Configure<AbpAutoMapperOptions>(options => |
|||
{ |
|||
options.AddMaps<BasketServiceApplicationModule>(); |
|||
}); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,20 @@ |
|||
<Project Sdk="Microsoft.NET.Sdk"> |
|||
|
|||
<Import Project="..\..\..\..\common.props" /> |
|||
|
|||
<PropertyGroup> |
|||
<TargetFramework>net6.0</TargetFramework> |
|||
<RootNamespace>EShopOnAbp.BasketService</RootNamespace> |
|||
</PropertyGroup> |
|||
|
|||
<ItemGroup> |
|||
<ProjectReference Include="..\EShopOnAbp.BasketService.Domain\EShopOnAbp.BasketService.Domain.csproj" /> |
|||
<ProjectReference Include="..\EShopOnAbp.BasketService.Application.Contracts\EShopOnAbp.BasketService.Application.Contracts.csproj" /> |
|||
</ItemGroup> |
|||
|
|||
<ItemGroup> |
|||
<PackageReference Include="Volo.Abp.AutoMapper" Version="5.0.0-beta.1" /> |
|||
<PackageReference Include="Volo.Abp.Ddd.Application" Version="5.0.0-beta.1" /> |
|||
</ItemGroup> |
|||
|
|||
</Project> |
|||
@ -0,0 +1,2 @@ |
|||
using System.Runtime.CompilerServices; |
|||
[assembly:InternalsVisibleToAttribute("EShopOnAbp.BasketService.Application.Tests")] |
|||
@ -0,0 +1,7 @@ |
|||
namespace EShopOnAbp.BasketService |
|||
{ |
|||
public static class BasketServiceDomainErrorCodes |
|||
{ |
|||
/* You can add your business exception error codes here, as constants */ |
|||
} |
|||
} |
|||
@ -0,0 +1,45 @@ |
|||
using EShopOnAbp.BasketService.Localization; |
|||
using Volo.Abp.Localization; |
|||
using Volo.Abp.Localization.ExceptionHandling; |
|||
using Volo.Abp.Modularity; |
|||
using Volo.Abp.Validation; |
|||
using Volo.Abp.Validation.Localization; |
|||
using Volo.Abp.VirtualFileSystem; |
|||
|
|||
namespace EShopOnAbp.BasketService |
|||
{ |
|||
[DependsOn( |
|||
typeof(AbpValidationModule) |
|||
)] |
|||
public class BasketServiceDomainSharedModule : AbpModule |
|||
{ |
|||
public override void PreConfigureServices(ServiceConfigurationContext context) |
|||
{ |
|||
BasketServiceGlobalFeatureConfigurator.Configure(); |
|||
BasketServiceModuleExtensionConfigurator.Configure(); |
|||
} |
|||
|
|||
public override void ConfigureServices(ServiceConfigurationContext context) |
|||
{ |
|||
Configure<AbpVirtualFileSystemOptions>(options => |
|||
{ |
|||
options.FileSets.AddEmbedded<BasketServiceDomainSharedModule>(); |
|||
}); |
|||
|
|||
Configure<AbpLocalizationOptions>(options => |
|||
{ |
|||
options.Resources |
|||
.Add<BasketServiceResource>("en") |
|||
.AddBaseTypes(typeof(AbpValidationResource)) |
|||
.AddVirtualJson("/Localization/BasketService"); |
|||
|
|||
options.DefaultResourceType = typeof(BasketServiceResource); |
|||
}); |
|||
|
|||
Configure<AbpExceptionLocalizationOptions>(options => |
|||
{ |
|||
options.MapCodeNamespace("BasketService", typeof(BasketServiceResource)); |
|||
}); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,23 @@ |
|||
using Volo.Abp.Threading; |
|||
|
|||
namespace EShopOnAbp.BasketService |
|||
{ |
|||
public static class BasketServiceGlobalFeatureConfigurator |
|||
{ |
|||
private static readonly OneTimeRunner OneTimeRunner = new OneTimeRunner(); |
|||
|
|||
public static void Configure() |
|||
{ |
|||
OneTimeRunner.Run(() => |
|||
{ |
|||
/* You can configure (enable/disable) global features of the used modules here. |
|||
* |
|||
* YOU CAN SAFELY DELETE THIS CLASS AND REMOVE ITS USAGES IF YOU DON'T NEED TO IT! |
|||
* |
|||
* Please refer to the documentation to lear more about the Global Features System: |
|||
* https://docs.abp.io/en/abp/latest/Global-Features
|
|||
*/ |
|||
}); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,69 @@ |
|||
using Volo.Abp.Threading; |
|||
|
|||
namespace EShopOnAbp.BasketService |
|||
{ |
|||
public static class BasketServiceModuleExtensionConfigurator |
|||
{ |
|||
private static readonly OneTimeRunner OneTimeRunner = new OneTimeRunner(); |
|||
|
|||
public static void Configure() |
|||
{ |
|||
OneTimeRunner.Run(() => |
|||
{ |
|||
ConfigureExistingProperties(); |
|||
ConfigureExtraProperties(); |
|||
}); |
|||
} |
|||
|
|||
private static void ConfigureExistingProperties() |
|||
{ |
|||
/* You can change max lengths for properties of the |
|||
* entities defined in the modules used by your application. |
|||
* |
|||
* Example: Change user and role name max lengths |
|||
|
|||
IdentityUserConsts.MaxNameLength = 99; |
|||
IdentityRoleConsts.MaxNameLength = 99; |
|||
|
|||
* Notice: It is not suggested to change property lengths |
|||
* unless you really need it. Go with the standard values wherever possible. |
|||
* |
|||
* If you are using EF Core, you will need to run the add-migration command after your changes. |
|||
*/ |
|||
} |
|||
|
|||
private static void ConfigureExtraProperties() |
|||
{ |
|||
/* You can configure extra properties for the |
|||
* entities defined in the modules used by your application. |
|||
* |
|||
* This class can be used to define these extra properties |
|||
* with a high level, easy to use API. |
|||
* |
|||
* Example: Add a new property to the user entity of the identity module |
|||
|
|||
ObjectExtensionManager.Instance.Modules() |
|||
.ConfigureIdentity(identity => |
|||
{ |
|||
identity.ConfigureUser(user => |
|||
{ |
|||
user.AddOrUpdateProperty<string>( //property type: string
|
|||
"SocialSecurityNumber", //property name
|
|||
property => |
|||
{ |
|||
//validation rules
|
|||
property.Attributes.Add(new RequiredAttribute()); |
|||
property.Attributes.Add(new StringLengthAttribute(64) {MinimumLength = 4}); |
|||
|
|||
//...other configurations for this property
|
|||
} |
|||
); |
|||
}); |
|||
}); |
|||
|
|||
* See the documentation for more: |
|||
* https://docs.abp.io/en/abp/latest/Module-Entity-Extensions
|
|||
*/ |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,25 @@ |
|||
<Project Sdk="Microsoft.NET.Sdk"> |
|||
|
|||
<Import Project="..\..\..\..\common.props" /> |
|||
|
|||
<PropertyGroup> |
|||
<TargetFramework>netstandard2.0</TargetFramework> |
|||
<RootNamespace>EShopOnAbp.BasketService</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\BasketService\*.json" /> |
|||
<Content Remove="Localization\BasketService\*.json" /> |
|||
</ItemGroup> |
|||
|
|||
</Project> |
|||
@ -0,0 +1,8 @@ |
|||
{ |
|||
"culture": "ar", |
|||
"texts": { |
|||
"Menu:Home": "الرئيسية", |
|||
"Welcome": "مرحبا", |
|||
"LongWelcomeMessage": "مرحبا بكم في التطبيق. هذا مشروع بدء تشغيل يعتمد على إطار عمل ABP. لمزيد من المعلومات ، يرجى زيارة abp.io." |
|||
} |
|||
} |
|||
@ -0,0 +1,8 @@ |
|||
{ |
|||
"culture": "cs", |
|||
"texts": { |
|||
"Menu:Home": "Úvod", |
|||
"Welcome": "Vítejte", |
|||
"LongWelcomeMessage": "Vítejte v aplikaci. Toto je startovací projekt založený na ABP frameworku. Pro více informací, navštivte abp.io." |
|||
} |
|||
} |
|||
@ -0,0 +1,8 @@ |
|||
{ |
|||
"culture": "de-DE", |
|||
"texts": { |
|||
"Menu:Home": "Home", |
|||
"Welcome": "Willkommen", |
|||
"LongWelcomeMessage": "Willkommen bei der Anwendung. Dies ist ein Startup-Projekt, das auf dem ABP-Framework basiert. Weitere Informationen finden Sie unter abp.io." |
|||
} |
|||
} |
|||
@ -0,0 +1,8 @@ |
|||
{ |
|||
"culture": "en-GB", |
|||
"texts": { |
|||
"Menu:Home": "Home", |
|||
"Welcome": "Welcome", |
|||
"LongWelcomeMessage": "Welcome to the application. This is a startup project based on the ABP framework. For more information, visit abp.io." |
|||
} |
|||
} |
|||
@ -0,0 +1,8 @@ |
|||
{ |
|||
"culture": "en", |
|||
"texts": { |
|||
"Menu:Home": "Home", |
|||
"Welcome": "Welcome", |
|||
"LongWelcomeMessage": "Welcome to the application. This is a startup project based on the ABP framework. For more information, visit abp.io." |
|||
} |
|||
} |
|||
@ -0,0 +1,8 @@ |
|||
{ |
|||
"culture": "es", |
|||
"texts": { |
|||
"Menu:Home": "Inicio", |
|||
"Welcome": "Bienvenido", |
|||
"LongWelcomeMessage": "Bienvenido a la aplicación, este es un proyecto base basado en el framework ABP. Para más información, visita abp.io." |
|||
} |
|||
} |
|||
@ -0,0 +1,8 @@ |
|||
{ |
|||
"culture": "fi", |
|||
"texts": { |
|||
"Menu:Home": "Koti", |
|||
"Welcome": "Tervetuloa", |
|||
"LongWelcomeMessage": "Tervetuloa sovellukseen. Tämä on ABP-kehykseen perustuva käynnistysprojekti. Lisätietoja on osoitteessa abp.io." |
|||
} |
|||
} |
|||
@ -0,0 +1,8 @@ |
|||
{ |
|||
"culture": "fr", |
|||
"texts": { |
|||
"Menu:Home": "Accueil", |
|||
"Welcome": "Bienvenue", |
|||
"LongWelcomeMessage": "Bienvenue dans l'application. Il s'agit d'un projet de démarrage basé sur le framework ABP. Pour plus d'informations, visitez abp.io." |
|||
} |
|||
} |
|||
@ -0,0 +1,8 @@ |
|||
{ |
|||
"culture": "hi", |
|||
"texts": { |
|||
"Menu:Home": "घर", |
|||
"Welcome": "स्वागत हे", |
|||
"LongWelcomeMessage": "आवेदन करने के लिए आपका स्वागत है। यह एबीपी ढांचे पर आधारित एक स्टार्टअप परियोजना है। अधिक जानकारी के लिए, abp.io पर जाएं।" |
|||
} |
|||
} |
|||
@ -0,0 +1,8 @@ |
|||
{ |
|||
"culture": "hu", |
|||
"texts": { |
|||
"Menu:Home": "Kezdőlap", |
|||
"Welcome": "Üdvözlöm", |
|||
"LongWelcomeMessage": "Üdvözöljük az alkalmazásban. Ez egy ABP keretrendszeren alapuló startup projekt. További információkért látogasson el az abp.io oldalra." |
|||
} |
|||
} |
|||
@ -0,0 +1,8 @@ |
|||
{ |
|||
"culture": "it", |
|||
"texts": { |
|||
"Menu:Home": "Home", |
|||
"Welcome": "Benvenuto", |
|||
"LongWelcomeMessage": "Benvenuto nell'applicazione. Questo è un progetto di avvio basato sul framework ABP. Per ulteriori informazioni, visita abp.io." |
|||
} |
|||
} |
|||
@ -0,0 +1,8 @@ |
|||
{ |
|||
"culture": "nl", |
|||
"texts": { |
|||
"Menu:Home": "Home", |
|||
"Welcome": "Welkom", |
|||
"LongWelcomeMessage": "Welkom bij de applicatie. Dit is een startup-project gebaseerd op het ABP-framework. Bezoek abp.io voor meer informatie." |
|||
} |
|||
} |
|||
@ -0,0 +1,8 @@ |
|||
{ |
|||
"culture": "pl-PL", |
|||
"texts": { |
|||
"Menu:Home": "Home", |
|||
"Welcome": "Witaj", |
|||
"LongWelcomeMessage": "Witaj w aplikacji. To jest inicjalny projekt bazujący na ABP framework. Po więcej informacji odwiedź stronę abp.io." |
|||
} |
|||
} |
|||
@ -0,0 +1,8 @@ |
|||
{ |
|||
"culture": "pt-BR", |
|||
"texts": { |
|||
"Menu:Home": "Principal", |
|||
"Welcome": "Seja bem-vindo!", |
|||
"LongWelcomeMessage": "Bem-vindo a esta aplicação. Este é um projeto inicial baseado no ABP framework. Para mais informações, visite abp.io." |
|||
} |
|||
} |
|||
@ -0,0 +1,8 @@ |
|||
{ |
|||
"culture": "ro-RO", |
|||
"texts": { |
|||
"Menu:Home": "Acasă", |
|||
"Welcome": "Bun venit", |
|||
"LongWelcomeMessage": "Bun venit la aplicaţie. Acesta este un proiect de pornire bazat pe framework-ul ABP. Pentru mai multe informaţii, vizitaţi, visit abp.io." |
|||
} |
|||
} |
|||
@ -0,0 +1,8 @@ |
|||
{ |
|||
"culture": "ru", |
|||
"texts": { |
|||
"Menu:Home": "Главная", |
|||
"Welcome": "Добро пожаловать", |
|||
"LongWelcomeMessage": "Добро пожаловать в приложение. Этот запущенный проект основан на фреймворке ABP. Для получения дополнительной информации посетите сайт abp.io." |
|||
} |
|||
} |
|||
@ -0,0 +1,8 @@ |
|||
{ |
|||
"culture": "sk", |
|||
"texts": { |
|||
"Menu:Home": "Domov", |
|||
"Welcome": "Vitajte", |
|||
"LongWelcomeMessage": "Vitajte v aplikácii. Toto je štartovací projekt založený na ABP frameworku. Viac informácií nájdete na stránke abp.io." |
|||
} |
|||
} |
|||
@ -0,0 +1,8 @@ |
|||
{ |
|||
"culture": "sl", |
|||
"texts": { |
|||
"Menu:Home": "Domov", |
|||
"Welcome": "Dobrodošli", |
|||
"LongWelcomeMessage": "Dobrodošli v aplikaciji. To je začetni projekt na osnovi okolja ABP. Za več informacij obiščite abp.io." |
|||
} |
|||
} |
|||
@ -0,0 +1,8 @@ |
|||
{ |
|||
"culture": "tr", |
|||
"texts": { |
|||
"Menu:Home": "Ana sayfa", |
|||
"Welcome": "Hoşgeldiniz", |
|||
"LongWelcomeMessage": "Uygulamaya hoşgeldiniz. Bu, ABP framework'ü üzerine bina edilmiş bir başlangıç projesidir. Daha fazla bilgi için abp.io adresini ziyaret edebilirsiniz." |
|||
} |
|||
} |
|||
@ -0,0 +1,8 @@ |
|||
{ |
|||
"culture": "vi", |
|||
"texts": { |
|||
"Menu:Home": "Trang chủ", |
|||
"Welcome": "Chào mừng bạn", |
|||
"LongWelcomeMessage": "Chào mừng bạn đến ứng dụng. Đây là một dự án khởi nghiệp dựa trên khung ABP. Để biết thêm thông tin, hãy truy cập abp.io." |
|||
} |
|||
} |
|||
@ -0,0 +1,8 @@ |
|||
{ |
|||
"culture": "zh-Hans", |
|||
"texts": { |
|||
"Menu:Home": "首页", |
|||
"Welcome": "欢迎", |
|||
"LongWelcomeMessage": "欢迎来到该应用程序. 这是一个基于ABP框架的启动项目. 有关更多信息, 请访问 abp.io." |
|||
} |
|||
} |
|||
@ -0,0 +1,8 @@ |
|||
{ |
|||
"culture": "zh-Hant", |
|||
"texts": { |
|||
"Menu:Home": "首頁", |
|||
"Welcome": "歡迎", |
|||
"LongWelcomeMessage": "歡迎來到此應用程式. 這是一個基於ABP框架的起始專案. 有關更多訊息, 請瀏覽 abp.io." |
|||
} |
|||
} |
|||
@ -0,0 +1,10 @@ |
|||
using Volo.Abp.Localization; |
|||
|
|||
namespace EShopOnAbp.BasketService.Localization |
|||
{ |
|||
[LocalizationResourceName("BasketService")] |
|||
public class BasketServiceResource |
|||
{ |
|||
|
|||
} |
|||
} |
|||
@ -0,0 +1,11 @@ |
|||
namespace EShopOnAbp.BasketService.MultiTenancy |
|||
{ |
|||
public static class MultiTenancyConsts |
|||
{ |
|||
/* Enable/disable multi-tenancy easily in a single point. |
|||
* If you will never need to multi-tenancy, you can remove |
|||
* related modules and code parts, including this file. |
|||
*/ |
|||
public const bool IsEnabled = true; |
|||
} |
|||
} |
|||
@ -0,0 +1,22 @@ |
|||
using EShopOnAbp.BasketService.MultiTenancy; |
|||
using Volo.Abp.Domain; |
|||
using Volo.Abp.Modularity; |
|||
using Volo.Abp.MultiTenancy; |
|||
|
|||
namespace EShopOnAbp.BasketService |
|||
{ |
|||
[DependsOn( |
|||
typeof(BasketServiceDomainSharedModule), |
|||
typeof(AbpDddDomainModule) |
|||
)] |
|||
public class BasketServiceDomainModule : AbpModule |
|||
{ |
|||
public override void ConfigureServices(ServiceConfigurationContext context) |
|||
{ |
|||
Configure<AbpMultiTenancyOptions>(options => |
|||
{ |
|||
options.IsEnabled = MultiTenancyConsts.IsEnabled; |
|||
}); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,18 @@ |
|||
<Project Sdk="Microsoft.NET.Sdk"> |
|||
|
|||
<Import Project="..\..\..\..\common.props" /> |
|||
|
|||
<PropertyGroup> |
|||
<TargetFramework>netstandard2.0</TargetFramework> |
|||
<RootNamespace>EShopOnAbp.BasketService</RootNamespace> |
|||
</PropertyGroup> |
|||
|
|||
<ItemGroup> |
|||
<ProjectReference Include="..\EShopOnAbp.BasketService.Domain.Shared\EShopOnAbp.BasketService.Domain.Shared.csproj" /> |
|||
</ItemGroup> |
|||
|
|||
<ItemGroup> |
|||
<PackageReference Include="Volo.Abp.Ddd.Domain" Version="5.0.0-beta.1" /> |
|||
</ItemGroup> |
|||
|
|||
</Project> |
|||
@ -0,0 +1,3 @@ |
|||
using System.Runtime.CompilerServices; |
|||
[assembly:InternalsVisibleToAttribute("EShopOnAbp.BasketService.Domain.Tests")] |
|||
[assembly:InternalsVisibleToAttribute("EShopOnAbp.BasketService.TestBase")] |
|||
@ -0,0 +1,13 @@ |
|||
using Volo.Abp.Settings; |
|||
|
|||
namespace EShopOnAbp.BasketService.Settings |
|||
{ |
|||
public class BasketServiceSettingDefinitionProvider : SettingDefinitionProvider |
|||
{ |
|||
public override void Define(ISettingDefinitionContext context) |
|||
{ |
|||
//Define your own settings here. Example:
|
|||
//context.Add(new SettingDefinition(BasketServiceSettings.MySetting1));
|
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,10 @@ |
|||
namespace EShopOnAbp.BasketService.Settings |
|||
{ |
|||
public static class BasketServiceSettings |
|||
{ |
|||
private const string Prefix = "BasketService"; |
|||
|
|||
//Add your own setting names here. Example:
|
|||
//public const string MySetting1 = Prefix + ".MySetting1";
|
|||
} |
|||
} |
|||
@ -0,0 +1,29 @@ |
|||
using Microsoft.Extensions.DependencyInjection; |
|||
using Volo.Abp.Http.Client; |
|||
using Volo.Abp.Modularity; |
|||
using Volo.Abp.VirtualFileSystem; |
|||
|
|||
namespace EShopOnAbp.BasketService |
|||
{ |
|||
[DependsOn( |
|||
typeof(BasketServiceApplicationContractsModule), |
|||
typeof(AbpHttpClientModule) |
|||
)] |
|||
public class BasketServiceHttpApiClientModule : AbpModule |
|||
{ |
|||
public const string RemoteServiceName = "Default"; |
|||
|
|||
public override void ConfigureServices(ServiceConfigurationContext context) |
|||
{ |
|||
context.Services.AddHttpClientProxies( |
|||
typeof(BasketServiceApplicationContractsModule).Assembly, |
|||
RemoteServiceName |
|||
); |
|||
|
|||
Configure<AbpVirtualFileSystemOptions>(options => |
|||
{ |
|||
options.FileSets.AddEmbedded<BasketServiceHttpApiClientModule>(); |
|||
}); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,23 @@ |
|||
<Project Sdk="Microsoft.NET.Sdk"> |
|||
|
|||
<Import Project="..\..\..\..\common.props" /> |
|||
|
|||
<PropertyGroup> |
|||
<TargetFramework>netstandard2.0</TargetFramework> |
|||
<RootNamespace>EShopOnAbp.BasketService</RootNamespace> |
|||
</PropertyGroup> |
|||
|
|||
<ItemGroup> |
|||
<ProjectReference Include="..\EShopOnAbp.BasketService.Application.Contracts\EShopOnAbp.BasketService.Application.Contracts.csproj" /> |
|||
</ItemGroup> |
|||
|
|||
<ItemGroup> |
|||
<PackageReference Include="Volo.Abp.Http.Client" Version="5.0.0-beta.1" /> |
|||
</ItemGroup> |
|||
|
|||
<ItemGroup> |
|||
<EmbeddedResource Include="**\*generate-proxy.json" /> |
|||
<Content Remove="**\*generate-proxy.json" /> |
|||
</ItemGroup> |
|||
|
|||
</Project> |
|||
@ -0,0 +1,91 @@ |
|||
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.BasketService |
|||
{ |
|||
[DependsOn( |
|||
typeof(BasketServiceHttpApiModule), |
|||
typeof(BasketServiceApplicationModule), |
|||
typeof(EShopOnAbpSharedHostingMicroservicesModule) |
|||
)] |
|||
public class BasketServiceHttpApiHostModule : AbpModule |
|||
{ |
|||
public override void ConfigureServices(ServiceConfigurationContext context) |
|||
{ |
|||
var configuration = context.Services.GetConfiguration(); |
|||
var hostingEnvironment = context.Services.GetHostingEnvironment(); |
|||
|
|||
JwtBearerConfigurationHelper.Configure(context, "BasketService"); |
|||
// SwaggerConfigurationHelper.Configure(context, "Basket 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 */ |
|||
{ |
|||
{"BasketService", "Catalog Service API"}, |
|||
}, |
|||
apiTitle: "Basket 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,13 @@ |
|||
using Microsoft.AspNetCore.Mvc; |
|||
using Volo.Abp.AspNetCore.Mvc; |
|||
|
|||
namespace EShopOnAbp.BasketService.Controllers |
|||
{ |
|||
public class HomeController : AbpController |
|||
{ |
|||
public ActionResult Index() |
|||
{ |
|||
return Redirect("~/swagger"); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,34 @@ |
|||
<Project Sdk="Microsoft.NET.Sdk.Web"> |
|||
|
|||
<Import Project="..\..\..\..\common.props" /> |
|||
|
|||
<PropertyGroup> |
|||
<TargetFramework>net6.0</TargetFramework> |
|||
<RootNamespace>EShopOnAbp.BasketService</RootNamespace> |
|||
<PreserveCompilationReferences>true</PreserveCompilationReferences> |
|||
<UserSecretsId>EShopOnAbp.BasketService-4681b4fd-151f-4221-84a4-929d86723e4c</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="..\EShopOnAbp.BasketService.Application\EShopOnAbp.BasketService.Application.csproj" /> |
|||
<ProjectReference Include="..\EShopOnAbp.BasketService.HttpApi\EShopOnAbp.BasketService.HttpApi.csproj" /> |
|||
</ItemGroup> |
|||
|
|||
<ItemGroup> |
|||
<ProjectReference Include="..\..\..\..\shared\EShopOnAbp.Shared.Hosting.Microservices\EShopOnAbp.Shared.Hosting.Microservices.csproj" /> |
|||
</ItemGroup> |
|||
|
|||
<ItemGroup> |
|||
<Compile Remove="Logs\**" /> |
|||
<Content Remove="Logs\**" /> |
|||
<EmbeddedResource Remove="Logs\**" /> |
|||
<None Remove="Logs\**" /> |
|||
</ItemGroup> |
|||
|
|||
</Project> |
|||
@ -0,0 +1,56 @@ |
|||
using System; |
|||
using Microsoft.AspNetCore.Hosting; |
|||
using Microsoft.Extensions.Configuration; |
|||
using Microsoft.Extensions.Hosting; |
|||
using Serilog; |
|||
using Serilog.Events; |
|||
|
|||
namespace EShopOnAbp.BasketService |
|||
{ |
|||
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) |
|||
.MinimumLevel.Override("Microsoft.EntityFrameworkCore", LogEventLevel.Warning) |
|||
.Enrich.FromLogContext() |
|||
.WriteTo.Async(c => c.File("Logs/logs.txt")) |
|||
#if DEBUG
|
|||
.WriteTo.Async(c => c.Console()) |
|||
#endif
|
|||
.CreateLogger(); |
|||
|
|||
try |
|||
{ |
|||
Log.Information("Starting EShopOnAbp.BasketService.HttpApi.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:44355", |
|||
"sslPort": 44355 |
|||
} |
|||
}, |
|||
"profiles": { |
|||
"IIS Express": { |
|||
"commandName": "IISExpress", |
|||
"launchBrowser": true, |
|||
"environmentVariables": { |
|||
"ASPNETCORE_ENVIRONMENT": "Development" |
|||
} |
|||
}, |
|||
"EShopOnAbp.BasketService.HttpApi.Host": { |
|||
"commandName": "Project", |
|||
"launchBrowser": true, |
|||
"applicationUrl": "https://localhost:44355", |
|||
"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.BasketService |
|||
{ |
|||
public class Startup |
|||
{ |
|||
public void ConfigureServices(IServiceCollection services) |
|||
{ |
|||
services.AddApplication<BasketServiceHttpApiHostModule>(); |
|||
} |
|||
|
|||
public void Configure(IApplicationBuilder app, IWebHostEnvironment env, ILoggerFactory loggerFactory) |
|||
{ |
|||
app.InitializeApplication(); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,2 @@ |
|||
{ |
|||
} |
|||
@ -0,0 +1,40 @@ |
|||
{ |
|||
"App": { |
|||
"SelfUrl": "https://localhost:44355", |
|||
"CorsOrigins": "https://localhost:44371,https://localhost:44372,https://localhost:44373" |
|||
}, |
|||
"AuthServer": { |
|||
"Authority": "https://localhost:44330", |
|||
"RequireHttpsMetadata": "true", |
|||
"SwaggerClientId": "IdentityService_Swagger", |
|||
"SwaggerClientSecret": "1q2w3e*" |
|||
}, |
|||
"Logging": { |
|||
"LogLevel": { |
|||
"Default": "Information", |
|||
"Microsoft": "Warning", |
|||
"Microsoft.Hosting.Lifetime": "Information" |
|||
} |
|||
}, |
|||
"AllowedHosts": "*", |
|||
"StringEncryption": { |
|||
"DefaultPassPhrase": "3PfxLgcuymUUbihz" |
|||
}, |
|||
"Redis": { |
|||
"Configuration": "localhost:6379" |
|||
}, |
|||
"RabbitMQ": { |
|||
"Connections": { |
|||
"Default": { |
|||
"HostName": "localhost" |
|||
} |
|||
}, |
|||
"EventBus": { |
|||
"ClientName": "EShopOnAbp_CatalogService", |
|||
"ExchangeName": "EShopOnAbp" |
|||
} |
|||
}, |
|||
"ElasticSearch": { |
|||
"Url": "http://localhost:9200" |
|||
} |
|||
} |
|||
@ -0,0 +1,2 @@ |
|||
{ |
|||
} |
|||
@ -0,0 +1 @@ |
|||
{"KeyId":"5eb863b25811a7099f9bc925c0fdf680","Parameters":{"D":"gqn7NAeMkug4twJJHFz/qPseDzQCx7R+6Maj649xrG4vPsMANV9mfR78Er2SuHUS0ZihM2MQEILI5Sf41Uuubv8swCNSE3Dw7GQrBIbTAJ7BZKbQMVgtGkMDtHrtri6d9cOi3EOTSJINICk9r80M49oBMOZihEKascfBSIUYVQvWLEMYfryEiDeFUPbobr10OxF5tZ1unvEKgZe190BdNKWQuFhJelcgsZumjEYNsOz5DHrK73WLhfTy01DmsTKx8i1XVnLtq6W89MqAhMZP9QO9Vj8lR0ANnmdOsY6hJfwUbXiI36t4V9rAZvXR5ESorjb4mnXzT6QPuOfy1fbdSQ==","DP":"ItYIpEqw6aDjDc/swDifUe0Dq6yl4yim3UyQ4B9NBPQR5M6b7D3vbCnvwql4zJK4s+0N4lRViBtkF+20Td1yc2v8S+THCYZCVxCf2e9Q7Ff/sKecJ9/JmdzHkztCfs0xb+4X3CPEQP+JIYtMGmwOLQgE5XgmUYKr0ahZDhYTCwE=","DQ":"v35mgxfyF/nwnWwWlR9cF3mg0v7SyPfKkwdxGaVnGH6G8nPWpPlO+zueflA5QDXEwGtk/1k3PAzI/OLUwJiKBubx/UMhsqt5+/bKTrFDNHxLANCvGNZggMZIzFZBYRucuXRZbiBe5qpCkKkniUct7w6jd/V1mnsESiJZ7btcxU0=","Exponent":"AQAB","InverseQ":"Vbg2a+wtaYvhTV8AzqJsVvaz0kfC4HFbmwEgA8+BAbS3GEoS3RHFSfB3DHndpnNihIg72DctDNLmV2GMMiTu18uyI+7AUaYNR836fByxptfyhPtSQfw4kINZ3V0GWKJGzzZ5NAOct4/FpRl8xliHetayCfUIuK9jwk0z9i6V6bA=","Modulus":"xlzmN1sBi2V1971MsPD5MTND9dAGncIzYqxa3H+9jx1mNDivY6JgKijUWm5a3D2Y1UPMB3kx6qUf3iH6pZHjq5bk938qRhxrPy9muW55U03HTiW4V5/ga0+OqXj5Tj4lz+29OiQHPErxLRgfXT+WBgrGb75ElzkHajKpJnPgzAZuarlUCwupJNQlav/crwOFrgkhGsnaOW13M8htiSLZozw5lxkbhYIei7YTTQZ3l6rVH1dPL8CvzRJJOTwbnU8k0sUmWiuOhrLzuinlr6uuOTocAVgbj943/witVFtN5B0yhetxEVgFCwxRDTOO1EKVHFtCiAyZBUOlK4gwZ+SbGQ==","P":"7dFfbAkZSdx/ieSMYJHoY1DKC4dLg80RObEEmuJ72MaVJLTtFuBPoRpYOrMUNuupIyPjZZsW8fHRlPRhKW7xFv+Q2aDudh1UaJzFZs3xYKoiXTU/j0B3TB3nrifVLMqsS+8kHOWOojwA4dMjI6GCYCpKmYVvMOE1cuJrQ9EYxoM=","Q":"1YdN8mLchLVoTEwD34Pi3T2U7EjjBDgDCzhjl7x5FBG73TyKMz1n7/KXkXcJ2rqIAsnLqCWpYUeRcWl+IQEQxFKoMwkvmQ33lRkOE0SBZ+FnUAMivRyxOD5qM9z4ccqx0ga4ZRgb1lR85f7VYtMSfIosOuSFxWAbV1e29utxhTM="}} |
|||
@ -0,0 +1,32 @@ |
|||
using EShopOnAbp.BasketService.Localization; |
|||
using Localization.Resources.AbpUi; |
|||
using Volo.Abp.AspNetCore.Mvc; |
|||
using Volo.Abp.Localization; |
|||
using Volo.Abp.Modularity; |
|||
|
|||
namespace EShopOnAbp.BasketService |
|||
{ |
|||
[DependsOn( |
|||
typeof(BasketServiceApplicationContractsModule), |
|||
typeof(AbpAspNetCoreMvcModule) |
|||
)] |
|||
public class BasketServiceHttpApiModule : AbpModule |
|||
{ |
|||
public override void ConfigureServices(ServiceConfigurationContext context) |
|||
{ |
|||
ConfigureLocalization(); |
|||
} |
|||
|
|||
private void ConfigureLocalization() |
|||
{ |
|||
Configure<AbpLocalizationOptions>(options => |
|||
{ |
|||
options.Resources |
|||
.Get<BasketServiceResource>() |
|||
.AddBaseTypes( |
|||
typeof(AbpUiResource) |
|||
); |
|||
}); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,15 @@ |
|||
using EShopOnAbp.BasketService.Localization; |
|||
using Volo.Abp.AspNetCore.Mvc; |
|||
|
|||
namespace EShopOnAbp.BasketService.Controllers |
|||
{ |
|||
/* Inherit your controllers from this class. |
|||
*/ |
|||
public abstract class BasketServiceController : AbpControllerBase |
|||
{ |
|||
protected BasketServiceController() |
|||
{ |
|||
LocalizationResource = typeof(BasketServiceResource); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,18 @@ |
|||
<Project Sdk="Microsoft.NET.Sdk"> |
|||
|
|||
<Import Project="..\..\..\..\common.props" /> |
|||
|
|||
<PropertyGroup> |
|||
<TargetFramework>net6.0</TargetFramework> |
|||
<RootNamespace>EShopOnAbp.BasketService</RootNamespace> |
|||
</PropertyGroup> |
|||
|
|||
<ItemGroup> |
|||
<ProjectReference Include="..\EShopOnAbp.BasketService.Application.Contracts\EShopOnAbp.BasketService.Application.Contracts.csproj" /> |
|||
</ItemGroup> |
|||
|
|||
<ItemGroup> |
|||
<PackageReference Include="Volo.Abp.AspNetCore.Mvc" Version="5.0.0-beta.1" /> |
|||
</ItemGroup> |
|||
|
|||
</Project> |
|||
@ -0,0 +1,7 @@ |
|||
namespace EShopOnAbp.BasketService |
|||
{ |
|||
public abstract class BasketServiceApplicationTestBase : BasketServiceTestBase<BasketServiceApplicationTestModule> |
|||
{ |
|||
|
|||
} |
|||
} |
|||
@ -0,0 +1,13 @@ |
|||
using Volo.Abp.Modularity; |
|||
|
|||
namespace EShopOnAbp.BasketService |
|||
{ |
|||
[DependsOn( |
|||
typeof(BasketServiceApplicationModule), |
|||
typeof(BasketServiceDomainTestModule) |
|||
)] |
|||
public class BasketServiceApplicationTestModule : AbpModule |
|||
{ |
|||
|
|||
} |
|||
} |
|||
@ -0,0 +1,19 @@ |
|||
<Project Sdk="Microsoft.NET.Sdk"> |
|||
|
|||
<Import Project="..\..\..\..\common.props" /> |
|||
|
|||
<PropertyGroup> |
|||
<TargetFramework>net6.0</TargetFramework> |
|||
<RootNamespace>EShopOnAbp.BasketService</RootNamespace> |
|||
</PropertyGroup> |
|||
|
|||
<ItemGroup> |
|||
<ProjectReference Include="..\..\src\EShopOnAbp.BasketService.Application\EShopOnAbp.BasketService.Application.csproj" /> |
|||
<ProjectReference Include="..\EShopOnAbp.BasketService.Domain.Tests\EShopOnAbp.BasketService.Domain.Tests.csproj" /> |
|||
</ItemGroup> |
|||
|
|||
<ItemGroup> |
|||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.11.0" /> |
|||
</ItemGroup> |
|||
|
|||
</Project> |
|||
@ -0,0 +1,7 @@ |
|||
namespace EShopOnAbp.BasketService |
|||
{ |
|||
public abstract class BasketServiceDomainTestBase : BasketServiceTestBase<BasketServiceDomainTestModule> |
|||
{ |
|||
|
|||
} |
|||
} |
|||
@ -0,0 +1,11 @@ |
|||
using Volo.Abp.Modularity; |
|||
|
|||
namespace EShopOnAbp.BasketService |
|||
{ |
|||
[DependsOn( |
|||
)] |
|||
public class BasketServiceDomainTestModule : AbpModule |
|||
{ |
|||
|
|||
} |
|||
} |
|||
@ -0,0 +1,18 @@ |
|||
<Project Sdk="Microsoft.NET.Sdk"> |
|||
|
|||
<Import Project="..\..\..\..\common.props" /> |
|||
|
|||
<PropertyGroup> |
|||
<TargetFramework>net6.0</TargetFramework> |
|||
<RootNamespace>EShopOnAbp.BasketService</RootNamespace> |
|||
</PropertyGroup> |
|||
|
|||
<ItemGroup> |
|||
<ProjectReference Include="..\EShopOnAbp.BasketService.EntityFrameworkCore.Tests\EShopOnAbp.BasketService.EntityFrameworkCore.Tests.csproj" /> |
|||
</ItemGroup> |
|||
|
|||
<ItemGroup> |
|||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.11.0" /> |
|||
</ItemGroup> |
|||
|
|||
</Project> |
|||
@ -0,0 +1,19 @@ |
|||
<Project Sdk="Microsoft.NET.Sdk"> |
|||
|
|||
<Import Project="..\..\..\..\common.props" /> |
|||
|
|||
<PropertyGroup> |
|||
<TargetFramework>net6.0</TargetFramework> |
|||
<RootNamespace>EShopOnAbp.BasketService</RootNamespace> |
|||
</PropertyGroup> |
|||
|
|||
<ItemGroup> |
|||
<ProjectReference Include="..\EShopOnAbp.BasketService.TestBase\EShopOnAbp.BasketService.TestBase.csproj" /> |
|||
<PackageReference Include="Volo.Abp.EntityFrameworkCore.Sqlite" Version="5.0.0-beta.1" /> |
|||
</ItemGroup> |
|||
|
|||
<ItemGroup> |
|||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.11.0" /> |
|||
</ItemGroup> |
|||
|
|||
</Project> |
|||
@ -0,0 +1,29 @@ |
|||
using System; |
|||
using Microsoft.Extensions.DependencyInjection; |
|||
using Polly; |
|||
using Volo.Abp.Http.Client; |
|||
using Volo.Abp.Http.Client.IdentityModel; |
|||
using Volo.Abp.Modularity; |
|||
|
|||
namespace EShopOnAbp.BasketService.HttpApi.Client.ConsoleTestApp |
|||
{ |
|||
[DependsOn( |
|||
typeof(BasketServiceHttpApiClientModule), |
|||
typeof(AbpHttpClientIdentityModelModule) |
|||
)] |
|||
public class BasketServiceConsoleApiClientModule : AbpModule |
|||
{ |
|||
public override void PreConfigureServices(ServiceConfigurationContext context) |
|||
{ |
|||
PreConfigure<AbpHttpClientBuilderOptions>(options => |
|||
{ |
|||
options.ProxyClientBuildActions.Add((remoteServiceName, clientBuilder) => |
|||
{ |
|||
clientBuilder.AddTransientHttpErrorPolicy( |
|||
policyBuilder => policyBuilder.WaitAndRetryAsync(3, i => TimeSpan.FromSeconds(Math.Pow(2, i))) |
|||
); |
|||
}); |
|||
}); |
|||
} |
|||
} |
|||
} |
|||
@ -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.BasketService.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<BasketServiceConsoleApiClientModule>(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> |
|||
</PropertyGroup> |
|||
|
|||
<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="Volo.Abp.Http.Client.IdentityModel" Version="5.0.0-beta.1" /> |
|||
<ProjectReference Include="..\..\src\EShopOnAbp.BasketService.HttpApi.Client\EShopOnAbp.BasketService.HttpApi.Client.csproj" /> |
|||
</ItemGroup> |
|||
|
|||
<ItemGroup> |
|||
<PackageReference Include="Microsoft.Extensions.Hosting" Version="6.0.0-rc.*" /> |
|||
<PackageReference Include="Microsoft.Extensions.Http.Polly" Version="6.0.0-rc.*" /> |
|||
</ItemGroup> |
|||
|
|||
</Project> |
|||
@ -0,0 +1,23 @@ |
|||
using System.Threading.Tasks; |
|||
using Microsoft.Extensions.Configuration; |
|||
using Microsoft.Extensions.DependencyInjection; |
|||
using Microsoft.Extensions.Hosting; |
|||
|
|||
namespace EShopOnAbp.BasketService.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,18 @@ |
|||
{ |
|||
"RemoteServices": { |
|||
"Default": { |
|||
"BaseUrl": "https://localhost:44376" |
|||
} |
|||
}, |
|||
"IdentityClients": { |
|||
"Default": { |
|||
"GrantType": "password", |
|||
"ClientId": "BasketService_App", |
|||
"ClientSecret": "1q2w3e*", |
|||
"UserName": "admin", |
|||
"UserPassword": "1q2w3E*", |
|||
"Authority": "https://localhost:44376", |
|||
"Scope": "BasketService" |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,2 @@ |
|||
{ |
|||
} |
|||
@ -0,0 +1,61 @@ |
|||
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.BasketService |
|||
{ |
|||
/* All test classes are derived from this class, directly or indirectly. |
|||
*/ |
|||
public abstract class BasketServiceTestBase<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,48 @@ |
|||
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.BasketService |
|||
{ |
|||
[DependsOn( |
|||
typeof(AbpAutofacModule), |
|||
typeof(AbpTestBaseModule), |
|||
typeof(AbpAuthorizationModule), |
|||
typeof(BasketServiceDomainModule) |
|||
)] |
|||
public class BasketServiceTestBaseModule : AbpModule |
|||
{ |
|||
|
|||
public override void ConfigureServices(ServiceConfigurationContext context) |
|||
{ |
|||
//Configure<AbpBackgroundJobOptions>(options =>
|
|||
//{
|
|||
// options.IsJobExecutionEnabled = false;
|
|||
//});
|
|||
|
|||
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,16 @@ |
|||
using System.Threading.Tasks; |
|||
using Volo.Abp.Data; |
|||
using Volo.Abp.DependencyInjection; |
|||
|
|||
namespace EShopOnAbp.BasketService |
|||
{ |
|||
public class BasketServiceTestDataSeedContributor : IDataSeedContributor, ITransientDependency |
|||
{ |
|||
public Task SeedAsync(DataSeedContext context) |
|||
{ |
|||
/* Seed additional test data... */ |
|||
|
|||
return Task.CompletedTask; |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,26 @@ |
|||
<Project Sdk="Microsoft.NET.Sdk"> |
|||
|
|||
<Import Project="..\..\..\..\common.props" /> |
|||
|
|||
<PropertyGroup> |
|||
<TargetFramework>net6.0</TargetFramework> |
|||
<RootNamespace>EShopOnAbp.BasketService</RootNamespace> |
|||
</PropertyGroup> |
|||
|
|||
<ItemGroup> |
|||
<PackageReference Include="Volo.Abp.TestBase" Version="5.0.0-beta.1" /> |
|||
<PackageReference Include="Volo.Abp.Autofac" Version="5.0.0-beta.1" /> |
|||
<PackageReference Include="Volo.Abp.Authorization" Version="5.0.0-beta.1" /> |
|||
<ProjectReference Include="..\..\src\EShopOnAbp.BasketService.Domain\EShopOnAbp.BasketService.Domain.csproj" /> |
|||
</ItemGroup> |
|||
|
|||
<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" /> |
|||
</ItemGroup> |
|||
|
|||
</Project> |
|||
@ -0,0 +1,43 @@ |
|||
using System.Collections.Generic; |
|||
using System.Security.Claims; |
|||
using Volo.Abp.DependencyInjection; |
|||
using Volo.Abp.Security.Claims; |
|||
|
|||
namespace EShopOnAbp.BasketService.Security |
|||
{ |
|||
[Dependency(ReplaceServices = true)] |
|||
public class FakeCurrentPrincipalAccessor : ThreadCurrentPrincipalAccessor |
|||
{ |
|||
protected override ClaimsPrincipal GetClaimsPrincipal() |
|||
{ |
|||
return GetPrincipal(); |
|||
} |
|||
|
|||
private ClaimsPrincipal _principal; |
|||
|
|||
private ClaimsPrincipal GetPrincipal() |
|||
{ |
|||
if (_principal == null) |
|||
{ |
|||
lock (this) |
|||
{ |
|||
if (_principal == null) |
|||
{ |
|||
_principal = new ClaimsPrincipal( |
|||
new ClaimsIdentity( |
|||
new List<Claim> |
|||
{ |
|||
new Claim(AbpClaimTypes.UserId,"2e701e62-0953-4dd3-910b-dc6cc93ccb0d"), |
|||
new Claim(AbpClaimTypes.UserName,"admin"), |
|||
new Claim(AbpClaimTypes.Email,"admin@abp.io") |
|||
} |
|||
) |
|||
); |
|||
} |
|||
} |
|||
} |
|||
|
|||
return _principal; |
|||
} |
|||
} |
|||
} |
|||
Loading…
Reference in new issue