Browse Source

👕 调整项目代码

IdentityServer4
WangJunZzz 4 years ago
parent
commit
0c14882843
  1. 2
      aspnet-core/Directory.Build.props
  2. 17
      aspnet-core/Lion.AbpPro.sln
  3. 16
      aspnet-core/modules/FileManagement/host/Lion.AbpPro.FileManagement.HttpApi.Host/FileManagementHttpApiHostModule.cs
  4. 1
      aspnet-core/modules/FileManagement/host/Lion.AbpPro.FileManagement.HttpApi.Host/Lion.AbpPro.FileManagement.HttpApi.Host.csproj
  5. 11
      aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Application.Contracts/Samples/ISampleAppService.cs
  6. 6
      aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Application.Contracts/Samples/SampleDto.cs
  7. 28
      aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Application/Samples/SampleAppService.cs
  8. 12
      aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.EntityFrameworkCore/EntityFrameworkCore/FileManagementEntityFrameworkCoreModule.cs
  9. 2
      aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.EntityFrameworkCore/Lion.AbpPro.FileManagement.EntityFrameworkCore.csproj
  10. 33
      aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.HttpApi/Samples/SampleController.cs
  11. 6
      aspnet-core/modules/FileManagement/test/Lion.AbpPro.FileManagement.Application.Tests/Lion.AbpPro.FileManagement.Application.Tests.csproj
  12. 29
      aspnet-core/modules/FileManagement/test/Lion.AbpPro.FileManagement.Application.Tests/Samples/SampleAppService_Tests.cs
  13. 156
      aspnet-core/modules/FileManagement/test/Lion.AbpPro.FileManagement.HttpApi.Client.ConsoleTestApp/ClientDemoService.cs
  14. 38
      aspnet-core/modules/FileManagement/test/Lion.AbpPro.FileManagement.HttpApi.Client.ConsoleTestApp/ConsoleTestAppHostedService.cs
  15. 16
      aspnet-core/modules/FileManagement/test/Lion.AbpPro.FileManagement.HttpApi.Client.ConsoleTestApp/FileManagementConsoleApiClientModule.cs
  16. 1
      aspnet-core/modules/FileManagement/test/Lion.AbpPro.FileManagement.HttpApi.Client.ConsoleTestApp/Lion.AbpPro.FileManagement.HttpApi.Client.ConsoleTestApp.abppkg.json
  17. 32
      aspnet-core/modules/FileManagement/test/Lion.AbpPro.FileManagement.HttpApi.Client.ConsoleTestApp/Lion.AbpPro.FileManagement.HttpApi.Client.ConsoleTestApp.csproj
  18. 23
      aspnet-core/modules/FileManagement/test/Lion.AbpPro.FileManagement.HttpApi.Client.ConsoleTestApp/Program.cs
  19. 21
      aspnet-core/modules/FileManagement/test/Lion.AbpPro.FileManagement.HttpApi.Client.ConsoleTestApp/appsettings.json
  20. 2
      aspnet-core/modules/FileManagement/test/Lion.AbpPro.FileManagement.HttpApi.Client.ConsoleTestApp/appsettings.secrets.json
  21. 12
      aspnet-core/modules/NotificationManagement/host/Lion.AbpPro.NotificationManagement.HttpApi.Host/Controllers/HomeController.cs
  22. 20
      aspnet-core/modules/NotificationManagement/host/Lion.AbpPro.NotificationManagement.HttpApi.Host/EntityFrameworkCore/FileManagementHttpApiHostMigrationsDbContext.cs
  23. 27
      aspnet-core/modules/NotificationManagement/host/Lion.AbpPro.NotificationManagement.HttpApi.Host/EntityFrameworkCore/FileManagementHttpApiHostMigrationsDbContextFactory.cs
  24. 3
      aspnet-core/modules/NotificationManagement/host/Lion.AbpPro.NotificationManagement.HttpApi.Host/FodyWeavers.xml
  25. 30
      aspnet-core/modules/NotificationManagement/host/Lion.AbpPro.NotificationManagement.HttpApi.Host/FodyWeavers.xsd
  26. 49
      aspnet-core/modules/NotificationManagement/host/Lion.AbpPro.NotificationManagement.HttpApi.Host/Lion.AbpPro.NotificationManagement.HttpApi.Host.csproj
  27. 162
      aspnet-core/modules/NotificationManagement/host/Lion.AbpPro.NotificationManagement.HttpApi.Host/Migrations/20220702015410_Init.Designer.cs
  28. 87
      aspnet-core/modules/NotificationManagement/host/Lion.AbpPro.NotificationManagement.HttpApi.Host/Migrations/20220702015410_Init.cs
  29. 160
      aspnet-core/modules/NotificationManagement/host/Lion.AbpPro.NotificationManagement.HttpApi.Host/Migrations/NotificationManagementHttpApiHostMigrationsDbContextModelSnapshot.cs
  30. 253
      aspnet-core/modules/NotificationManagement/host/Lion.AbpPro.NotificationManagement.HttpApi.Host/NotificationManagementHttpApiHostModule.cs
  31. 24
      aspnet-core/modules/NotificationManagement/host/Lion.AbpPro.NotificationManagement.HttpApi.Host/Program.cs
  32. 12
      aspnet-core/modules/NotificationManagement/host/Lion.AbpPro.NotificationManagement.HttpApi.Host/Properties/launchSettings.json
  33. 19
      aspnet-core/modules/NotificationManagement/host/Lion.AbpPro.NotificationManagement.HttpApi.Host/Startup.cs
  34. 20
      aspnet-core/modules/NotificationManagement/host/Lion.AbpPro.NotificationManagement.HttpApi.Host/appsettings.json
  35. 2
      aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Domain/Notifications/Aggregates/Notification.cs
  36. 2
      aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Domain/Notifications/NotificationManager.cs
  37. 79
      aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/AbpProHttpApiHostModule.cs
  38. 3
      aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/Controllers/HomeController.cs
  39. 7
      aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/Extensions/Hangfire/AutoDeleteAfterSuccessAttributer.cs
  40. 3
      aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/Extensions/Hangfire/CronType.cs
  41. 4
      aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/Extensions/Hangfire/CustomHangfireAuthorizeFilter.cs
  42. 6
      aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/Extensions/Hangfire/JobRetryLastFilter.cs
  43. 23
      aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/Extensions/MVC/Filters/ResultExceptionFilter.cs
  44. 4
      aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/Extensions/Middlewares/AbpProApplicationBuilderExtensionsExtensions.cs
  45. 9
      aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/Extensions/Middlewares/RequestLogMiddleware.cs
  46. 5
      aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/Extensions/RecurringJobsExtensions.cs
  47. 7
      aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/Extensions/SerilogToEsExtensions.cs
  48. 4
      aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/Extensions/System/WrapResultAttribute.cs
  49. 76
      aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/GlobalUsings.cs
  50. 7
      aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/Pages/Login.cshtml.cs
  51. 9
      aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/Program.cs
  52. 6
      aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/Startup.cs
  53. 4
      aspnet-core/services/src/Lion.AbpPro.Application/Roles/RolePermissionAppService.cs
  54. 38
      aspnet-core/services/src/Lion.AbpPro.Application/Users/UserAppService.cs
  55. 2
      aspnet-core/services/src/Lion.AbpPro.EntityFrameworkCore/EntityFrameworkCore/Users/BulkImportUserRepository.cs
  56. 1
      vben271/src/views/sys/login/useLogin.ts

2
aspnet-core/Directory.Build.props

@ -1,7 +1,7 @@
<Project>
<PropertyGroup>
<AbpPackageVersion>5.3.0</AbpPackageVersion>
<AbpPackageVersion>5.3.1</AbpPackageVersion>
<DotNetCoreCAPVersion>6.1.0</DotNetCoreCAPVersion>
<MicrosoftVersion>6.0.6</MicrosoftVersion>
<MicrosoftExtensionsHostingVersion>6.0.1</MicrosoftExtensionsHostingVersion>

17
aspnet-core/Lion.AbpPro.sln

@ -162,8 +162,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Lion.AbpPro.FileManagement.
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Lion.AbpPro.FileManagement.EntityFrameworkCore.Tests", "modules\FileManagement\test\Lion.AbpPro.FileManagement.EntityFrameworkCore.Tests\Lion.AbpPro.FileManagement.EntityFrameworkCore.Tests.csproj", "{80E12564-E2B3-4307-B40E-20E24BF02916}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Lion.AbpPro.FileManagement.HttpApi.Client.ConsoleTestApp", "modules\FileManagement\test\Lion.AbpPro.FileManagement.HttpApi.Client.ConsoleTestApp\Lion.AbpPro.FileManagement.HttpApi.Client.ConsoleTestApp.csproj", "{9201AEE4-2E6D-4A48-805F-3F3C6878BC0B}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Lion.AbpPro.FileManagement.TestBase", "modules\FileManagement\test\Lion.AbpPro.FileManagement.TestBase\Lion.AbpPro.FileManagement.TestBase.csproj", "{78589964-923E-4803-9B74-183487C3ED0F}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Lion.AbpPro.FileManagement.HttpApi.Host", "modules\FileManagement\host\Lion.AbpPro.FileManagement.HttpApi.Host\Lion.AbpPro.FileManagement.HttpApi.Host.csproj", "{831CD22A-AC6E-4515-AB24-8C96B34C717F}"
@ -172,6 +170,10 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Lion.AbpPro.FreeSqlReposito
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Lion.AbpPro.FreeSqlRepository.Tests", "services\test\Lion.AbpPro.FreeSqlRepository.Tests\Lion.AbpPro.FreeSqlRepository.Tests.csproj", "{7971DF5A-B001-4751-8F40-D7752C612BF1}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "host", "host", "{7FF93622-971D-4B30-A5FC-72D729D26E29}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Lion.AbpPro.NotificationManagement.HttpApi.Host", "modules\NotificationManagement\host\Lion.AbpPro.NotificationManagement.HttpApi.Host\Lion.AbpPro.NotificationManagement.HttpApi.Host.csproj", "{FA5E029F-1826-4C1E-8AED-6FA5C3362A3A}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -390,10 +392,6 @@ Global
{80E12564-E2B3-4307-B40E-20E24BF02916}.Debug|Any CPU.Build.0 = Debug|Any CPU
{80E12564-E2B3-4307-B40E-20E24BF02916}.Release|Any CPU.ActiveCfg = Release|Any CPU
{80E12564-E2B3-4307-B40E-20E24BF02916}.Release|Any CPU.Build.0 = Release|Any CPU
{9201AEE4-2E6D-4A48-805F-3F3C6878BC0B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9201AEE4-2E6D-4A48-805F-3F3C6878BC0B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9201AEE4-2E6D-4A48-805F-3F3C6878BC0B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9201AEE4-2E6D-4A48-805F-3F3C6878BC0B}.Release|Any CPU.Build.0 = Release|Any CPU
{78589964-923E-4803-9B74-183487C3ED0F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{78589964-923E-4803-9B74-183487C3ED0F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{78589964-923E-4803-9B74-183487C3ED0F}.Release|Any CPU.ActiveCfg = Release|Any CPU
@ -410,6 +408,10 @@ Global
{7971DF5A-B001-4751-8F40-D7752C612BF1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7971DF5A-B001-4751-8F40-D7752C612BF1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7971DF5A-B001-4751-8F40-D7752C612BF1}.Release|Any CPU.Build.0 = Release|Any CPU
{FA5E029F-1826-4C1E-8AED-6FA5C3362A3A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{FA5E029F-1826-4C1E-8AED-6FA5C3362A3A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FA5E029F-1826-4C1E-8AED-6FA5C3362A3A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FA5E029F-1826-4C1E-8AED-6FA5C3362A3A}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@ -486,11 +488,12 @@ Global
{E6D3F0F8-0683-4A00-8459-C9C4C65D825D} = {40BF21CB-4520-45A6-A588-5FFB95BAC87C}
{C912E1E7-4F8F-4ADB-BB27-D40B1903FED0} = {40BF21CB-4520-45A6-A588-5FFB95BAC87C}
{80E12564-E2B3-4307-B40E-20E24BF02916} = {40BF21CB-4520-45A6-A588-5FFB95BAC87C}
{9201AEE4-2E6D-4A48-805F-3F3C6878BC0B} = {40BF21CB-4520-45A6-A588-5FFB95BAC87C}
{78589964-923E-4803-9B74-183487C3ED0F} = {40BF21CB-4520-45A6-A588-5FFB95BAC87C}
{831CD22A-AC6E-4515-AB24-8C96B34C717F} = {C188A1F4-9601-42E5-9A0A-B282E13EAC41}
{27C7A0E6-4C2E-4AFF-9DE7-1F526DDC0D18} = {CA9AC87F-097E-4F15-8393-4BC07735A5B0}
{7971DF5A-B001-4751-8F40-D7752C612BF1} = {04DBDB01-70F4-4E06-B468-8F87850B22BE}
{7FF93622-971D-4B30-A5FC-72D729D26E29} = {EB2B8705-18E7-49E1-A565-93A6DE5570D5}
{FA5E029F-1826-4C1E-8AED-6FA5C3362A3A} = {7FF93622-971D-4B30-A5FC-72D729D26E29}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {28315BFD-90E7-4E14-A2EA-F3D23AF4126F}

16
aspnet-core/modules/FileManagement/host/Lion.AbpPro.FileManagement.HttpApi.Host/FileManagementHttpApiHostModule.cs

@ -15,6 +15,8 @@ using Volo.Abp.AspNetCore.Serilog;
using Volo.Abp.Autofac;
using Volo.Abp.Caching;
using Volo.Abp.Caching.StackExchangeRedis;
using Volo.Abp.EntityFrameworkCore;
using Volo.Abp.EntityFrameworkCore.MySQL;
using Volo.Abp.Localization;
using Volo.Abp.Modularity;
using Volo.Abp.Swashbuckle;
@ -29,7 +31,8 @@ namespace Lion.AbpPro.FileManagement;
typeof(AbpAutofacModule),
typeof(AbpCachingStackExchangeRedisModule),
typeof(AbpAspNetCoreSerilogModule),
typeof(AbpSwashbuckleModule)
typeof(AbpSwashbuckleModule),
typeof(AbpEntityFrameworkCoreMySQLModule)
)]
public class FileManagementHttpApiHostModule : AbpModule
{
@ -43,6 +46,7 @@ public class FileManagementHttpApiHostModule : AbpModule
ConfigureLocalization();
ConfigureCache(context);
ConfigureCors(context);
ConfigDB();
}
public override void OnApplicationInitialization(ApplicationInitializationContext context)
@ -121,6 +125,16 @@ public class FileManagementHttpApiHostModule : AbpModule
{
Configure<AbpAntiForgeryOptions>(options => { options.AutoValidate = false; });
}
private void ConfigDB()
{
Configure<AbpDbContextOptions>(options =>
{
/* The main point to change your DBMS.
* See also OperationsMigrationsDbContextFactory for EF Core tooling. */
options.UseMySQL();
});
}
/// <summary>
/// 配置本地化

1
aspnet-core/modules/FileManagement/host/Lion.AbpPro.FileManagement.HttpApi.Host/Lion.AbpPro.FileManagement.HttpApi.Host.csproj

@ -22,6 +22,7 @@
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="$(MicrosoftVersion)" />
<PackageReference Include="Microsoft.AspNetCore.DataProtection.StackExchangeRedis" Version="$(MicrosoftVersion)" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="$(MicrosoftVersion)" />
<PackageReference Include="Volo.Abp.EntityFrameworkCore.MySQL" Version="$(AbpPackageVersion)" />
<PackageReference Include="Volo.Abp.Autofac" Version="$(AbpPackageVersion)" />
<PackageReference Include="Volo.Abp.Caching.StackExchangeRedis" Version="$(AbpPackageVersion)" />
<PackageReference Include="Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy" Version="$(AbpPackageVersion)" />

11
aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Application.Contracts/Samples/ISampleAppService.cs

@ -1,11 +0,0 @@
using System.Threading.Tasks;
using Volo.Abp.Application.Services;
namespace Lion.AbpPro.FileManagement.Samples;
public interface ISampleAppService : IApplicationService
{
Task<SampleDto> GetAsync();
Task<SampleDto> GetAuthorizedAsync();
}

6
aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Application.Contracts/Samples/SampleDto.cs

@ -1,6 +0,0 @@
namespace Lion.AbpPro.FileManagement.Samples;
public class SampleDto
{
public int Value { get; set; }
}

28
aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Application/Samples/SampleAppService.cs

@ -1,28 +0,0 @@
using System.Threading.Tasks;
using Microsoft.AspNetCore.Authorization;
namespace Lion.AbpPro.FileManagement.Samples;
public class SampleAppService : FileManagementAppService, ISampleAppService
{
public Task<SampleDto> GetAsync()
{
return Task.FromResult(
new SampleDto
{
Value = 42
}
);
}
[Authorize]
public Task<SampleDto> GetAuthorizedAsync()
{
return Task.FromResult(
new SampleDto
{
Value = 42
}
);
}
}

12
aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.EntityFrameworkCore/EntityFrameworkCore/FileManagementEntityFrameworkCoreModule.cs

@ -1,13 +1,10 @@
using Microsoft.Extensions.DependencyInjection;
using Volo.Abp.EntityFrameworkCore;
using Volo.Abp.EntityFrameworkCore.MySQL;
using Volo.Abp.Modularity;
namespace Lion.AbpPro.FileManagement.EntityFrameworkCore;
[DependsOn(
typeof(FileManagementDomainModule),
typeof(AbpEntityFrameworkCoreMySQLModule)
typeof(FileManagementDomainModule)
)]
public class FileManagementEntityFrameworkCoreModule : AbpModule
{
@ -20,12 +17,5 @@ public class FileManagementEntityFrameworkCoreModule : AbpModule
*/
options.AddDefaultRepositories(true);
});
Configure<AbpDbContextOptions>(options =>
{
/* The main point to change your DBMS.
* See also OperationsMigrationsDbContextFactory for EF Core tooling. */
options.UseMySQL();
});
}
}

2
aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.EntityFrameworkCore/Lion.AbpPro.FileManagement.EntityFrameworkCore.csproj

@ -8,7 +8,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Volo.Abp.EntityFrameworkCore.MySQL" Version="$(AbpPackageVersion)" />
<PackageReference Include="Volo.Abp.EntityFrameworkCore" Version="$(AbpPackageVersion)" />
<ProjectReference Include="..\Lion.AbpPro.FileManagement.Domain\Lion.AbpPro.FileManagement.Domain.csproj" />
</ItemGroup>

33
aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.HttpApi/Samples/SampleController.cs

@ -1,33 +0,0 @@
using System.Threading.Tasks;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Volo.Abp;
namespace Lion.AbpPro.FileManagement.Samples;
[Area(FileManagementRemoteServiceConsts.ModuleName)]
[RemoteService(Name = FileManagementRemoteServiceConsts.RemoteServiceName)]
[Route("api/FileManagement/sample")]
public class SampleController : FileManagementController, ISampleAppService
{
private readonly ISampleAppService _sampleAppService;
public SampleController(ISampleAppService sampleAppService)
{
_sampleAppService = sampleAppService;
}
[HttpGet]
public async Task<SampleDto> GetAsync()
{
return await _sampleAppService.GetAsync();
}
[HttpGet]
[Route("authorized")]
[Authorize]
public async Task<SampleDto> GetAuthorizedAsync()
{
return await _sampleAppService.GetAsync();
}
}

6
aspnet-core/modules/FileManagement/test/Lion.AbpPro.FileManagement.Application.Tests/Lion.AbpPro.FileManagement.Application.Tests.csproj

@ -8,9 +8,9 @@
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\Lion.AbpPro.FileManagement.Application\Lion.AbpPro.FileManagement.Application.csproj"/>
<ProjectReference Include="..\Lion.AbpPro.FileManagement.Domain.Tests\Lion.AbpPro.FileManagement.Domain.Tests.csproj"/>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="$(MicrosoftNETTestSdkVersion)"/>
<ProjectReference Include="..\..\src\Lion.AbpPro.FileManagement.Application\Lion.AbpPro.FileManagement.Application.csproj" />
<ProjectReference Include="..\Lion.AbpPro.FileManagement.Domain.Tests\Lion.AbpPro.FileManagement.Domain.Tests.csproj" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="$(MicrosoftNETTestSdkVersion)" />
</ItemGroup>
</Project>

29
aspnet-core/modules/FileManagement/test/Lion.AbpPro.FileManagement.Application.Tests/Samples/SampleAppService_Tests.cs

@ -1,29 +0,0 @@
using System.Threading.Tasks;
using Shouldly;
using Xunit;
namespace Lion.AbpPro.FileManagement.Samples;
public class SampleAppService_Tests : FileManagementApplicationTestBase
{
private readonly ISampleAppService _sampleAppService;
public SampleAppService_Tests()
{
_sampleAppService = GetRequiredService<ISampleAppService>();
}
[Fact]
public async Task GetAsync()
{
var result = await _sampleAppService.GetAsync();
result.Value.ShouldBe(42);
}
[Fact]
public async Task GetAuthorizedAsync()
{
var result = await _sampleAppService.GetAuthorizedAsync();
result.Value.ShouldBe(42);
}
}

156
aspnet-core/modules/FileManagement/test/Lion.AbpPro.FileManagement.HttpApi.Client.ConsoleTestApp/ClientDemoService.cs

@ -1,156 +0,0 @@
using System;
using System.Net.Http;
using System.Threading.Tasks;
using IdentityModel.Client;
using Microsoft.Extensions.Configuration;
using Lion.AbpPro.FileManagement.Samples;
using Volo.Abp.DependencyInjection;
using Volo.Abp.IdentityModel;
namespace Lion.AbpPro.FileManagement
{
public class ClientDemoService : ITransientDependency
{
private readonly ISampleAppService _sampleAppService;
private readonly IIdentityModelAuthenticationService _authenticationService;
private readonly IConfiguration _configuration;
public ClientDemoService(
ISampleAppService sampleAppService,
IIdentityModelAuthenticationService authenticationService,
IConfiguration configuration)
{
_sampleAppService = sampleAppService;
_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)} *****");
var result = await _sampleAppService.GetAsync();
Console.WriteLine("Result: " + result.Value);
result = await _sampleAppService.GetAuthorizedAsync();
Console.WriteLine("Result (authorized): " + result.Value);
}
/* 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:FileManagement:BaseUrl"] +
"api/FileManagement/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:FileManagement:BaseUrl"] +
"api/FileManagement/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);
}
}
}
}
}

38
aspnet-core/modules/FileManagement/test/Lion.AbpPro.FileManagement.HttpApi.Client.ConsoleTestApp/ConsoleTestAppHostedService.cs

@ -1,38 +0,0 @@
using Microsoft.Extensions.Hosting;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Volo.Abp;
namespace Lion.AbpPro.FileManagement.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<FileManagementConsoleApiClientModule>(options=>
{
options.Services.ReplaceConfiguration(_configuration);
options.UseAutofac();
}))
{
application.Initialize();
var demo = application.ServiceProvider.GetRequiredService<ClientDemoService>();
await demo.RunAsync();
application.Shutdown();
}
}
public Task StopAsync(CancellationToken cancellationToken) => Task.CompletedTask;
}
}

16
aspnet-core/modules/FileManagement/test/Lion.AbpPro.FileManagement.HttpApi.Client.ConsoleTestApp/FileManagementConsoleApiClientModule.cs

@ -1,16 +0,0 @@
using Volo.Abp.Autofac;
using Volo.Abp.Http.Client.IdentityModel;
using Volo.Abp.Modularity;
namespace Lion.AbpPro.FileManagement
{
[DependsOn(
typeof(AbpAutofacModule),
typeof(FileManagementHttpApiClientModule),
typeof(AbpHttpClientIdentityModelModule)
)]
public class FileManagementConsoleApiClientModule : AbpModule
{
}
}

1
aspnet-core/modules/FileManagement/test/Lion.AbpPro.FileManagement.HttpApi.Client.ConsoleTestApp/Lion.AbpPro.FileManagement.HttpApi.Client.ConsoleTestApp.abppkg.json

@ -1 +0,0 @@
{}

32
aspnet-core/modules/FileManagement/test/Lion.AbpPro.FileManagement.HttpApi.Client.ConsoleTestApp/Lion.AbpPro.FileManagement.HttpApi.Client.ConsoleTestApp.csproj

@ -1,32 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<RootNamespace>Lion.AbpPro.FileManagement</RootNamespace>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Volo.Abp.Http.Client.IdentityModel" Version="$(AbpPackageVersion)" />
<PackageReference Include="Volo.Abp.Autofac" Version="$(AbpPackageVersion)" />
<ProjectReference Include="..\..\src\Lion.AbpPro.FileManagement.HttpApi.Client\Lion.AbpPro.FileManagement.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" />
</ItemGroup>
</Project>

23
aspnet-core/modules/FileManagement/test/Lion.AbpPro.FileManagement.HttpApi.Client.ConsoleTestApp/Program.cs

@ -1,23 +0,0 @@
using System.Threading.Tasks;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
namespace Lion.AbpPro.FileManagement.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>();
});
}
}

21
aspnet-core/modules/FileManagement/test/Lion.AbpPro.FileManagement.HttpApi.Client.ConsoleTestApp/appsettings.json

@ -1,21 +0,0 @@
{
"RemoteServices": {
"Default": {
"BaseUrl": "https://localhost:44384/"
},
"FileManagement": {
"BaseUrl": "https://localhost:44373/"
}
},
"IdentityClients": {
"Default": {
"GrantType": "password",
"ClientId": "FileManagement_App",
"ClientSecret": "1q2w3e*",
"UserName": "admin",
"UserPassword": "1q2w3E*",
"Authority": "https://localhost:44384/",
"Scope": "FileManagement"
}
}
}

2
aspnet-core/modules/FileManagement/test/Lion.AbpPro.FileManagement.HttpApi.Client.ConsoleTestApp/appsettings.secrets.json

@ -1,2 +0,0 @@
{
}

12
aspnet-core/modules/NotificationManagement/host/Lion.AbpPro.NotificationManagement.HttpApi.Host/Controllers/HomeController.cs

@ -0,0 +1,12 @@
using Microsoft.AspNetCore.Mvc;
using Volo.Abp.AspNetCore.Mvc;
namespace Lion.AbpPro.NotificationManagement.Controllers;
public class HomeController : AbpController
{
public ActionResult Index()
{
return Redirect("~/swagger");
}
}

20
aspnet-core/modules/NotificationManagement/host/Lion.AbpPro.NotificationManagement.HttpApi.Host/EntityFrameworkCore/FileManagementHttpApiHostMigrationsDbContext.cs

@ -0,0 +1,20 @@
using Microsoft.EntityFrameworkCore;
using Volo.Abp.EntityFrameworkCore;
namespace Lion.AbpPro.NotificationManagement.EntityFrameworkCore;
public class NotificationManagementHttpApiHostMigrationsDbContext : AbpDbContext<NotificationManagementHttpApiHostMigrationsDbContext>
{
public NotificationManagementHttpApiHostMigrationsDbContext(DbContextOptions<NotificationManagementHttpApiHostMigrationsDbContext> options)
: base(options)
{
}
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
base.OnModelCreating(modelBuilder);
modelBuilder.ConfigureNotificationManagement();
}
}

27
aspnet-core/modules/NotificationManagement/host/Lion.AbpPro.NotificationManagement.HttpApi.Host/EntityFrameworkCore/FileManagementHttpApiHostMigrationsDbContextFactory.cs

@ -0,0 +1,27 @@
using System.IO;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Design;
using Microsoft.Extensions.Configuration;
namespace Lion.AbpPro.NotificationManagement.EntityFrameworkCore;
public class NotificationManagementHttpApiHostMigrationsDbContextFactory : IDesignTimeDbContextFactory<NotificationManagementHttpApiHostMigrationsDbContext>
{
public NotificationManagementHttpApiHostMigrationsDbContext CreateDbContext(string[] args)
{
var configuration = BuildConfiguration();
var builder = new DbContextOptionsBuilder<NotificationManagementHttpApiHostMigrationsDbContext>()
.UseMySql(configuration.GetConnectionString(NotificationManagementDbProperties.ConnectionStringName), MySqlServerVersion.LatestSupportedServerVersion);
return new NotificationManagementHttpApiHostMigrationsDbContext(builder.Options);
}
private static IConfigurationRoot BuildConfiguration()
{
var builder = new ConfigurationBuilder()
.SetBasePath(Directory.GetCurrentDirectory())
.AddJsonFile("appsettings.json", optional: false);
return builder.Build();
}
}

3
aspnet-core/modules/NotificationManagement/host/Lion.AbpPro.NotificationManagement.HttpApi.Host/FodyWeavers.xml

@ -0,0 +1,3 @@
<Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd">
<ConfigureAwait ContinueOnCapturedContext="false"/>
</Weavers>

30
aspnet-core/modules/NotificationManagement/host/Lion.AbpPro.NotificationManagement.HttpApi.Host/FodyWeavers.xsd

@ -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>

49
aspnet-core/modules/NotificationManagement/host/Lion.AbpPro.NotificationManagement.HttpApi.Host/Lion.AbpPro.NotificationManagement.HttpApi.Host.csproj

@ -0,0 +1,49 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<Import Project="../../../../common.props" />
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<RootNamespace>Lion.AbpPro.NotificationManagement</RootNamespace>
<PreserveCompilationReferences>true</PreserveCompilationReferences>
<UserSecretsId>Lion.AbpPro.NotificationManagement-c2d31439-b723-48e2-b061-5ebd7aeb6010</UserSecretsId>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Serilog" Version="$(SerilogVersion)" />
<PackageReference Include="Serilog.AspNetCore" Version="$(SerilogAspNetCoreVersion)" />
<PackageReference Include="Serilog.Exceptions" Version="$(SerilogExceptionsVersion)" />
<PackageReference Include="Serilog.Extensions.Logging" Version="$(SerilogExtensionsLoggingVersion)" />
<PackageReference Include="Serilog.Settings.Configuration" Version="$(SerilogSettingsConfigurationVersion)" />
<PackageReference Include="Serilog.Sinks.Console" Version="$(SerilogSinksConsoleVersion)" />
<PackageReference Include="Serilog.Sinks.Elasticsearch" Version="$(SerilogSinksElasticsearchVersion)" />
<PackageReference Include="Serilog.Sinks.File" Version="$(SerilogSinksFileVersion)" />
<PackageReference Include="IdentityModel" Version="5.1.0" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="$(MicrosoftVersion)" />
<PackageReference Include="Microsoft.AspNetCore.DataProtection.StackExchangeRedis" Version="$(MicrosoftVersion)" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="$(MicrosoftVersion)" />
<PackageReference Include="Volo.Abp.EntityFrameworkCore.MySQL" Version="$(AbpPackageVersion)" />
<PackageReference Include="Volo.Abp.Autofac" Version="$(AbpPackageVersion)" />
<PackageReference Include="Volo.Abp.Caching.StackExchangeRedis" Version="$(AbpPackageVersion)" />
<PackageReference Include="Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy" Version="$(AbpPackageVersion)" />
<PackageReference Include="Volo.Abp.AspNetCore.Serilog" Version="$(AbpPackageVersion)" />
<PackageReference Include="Volo.Abp.Swashbuckle" Version="$(AbpPackageVersion)" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="$(SwashbuckleVersion)" />
<PackageReference Include="Swashbuckle.AspNetCore.Annotations" Version="$(SwashbuckleVersion)" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\..\frameworks\CAP\src\Lion.AbpPro.CAP\Lion.AbpPro.CAP.csproj" />
<ProjectReference Include="..\..\src\Lion.AbpPro.NotificationManagement.HttpApi\Lion.AbpPro.NotificationManagement.HttpApi.csproj" />
<ProjectReference Include="..\..\src\Lion.AbpPro.NotificationManagement.Application\Lion.AbpPro.NotificationManagement.Application.csproj" />
<ProjectReference Include="..\..\src\Lion.AbpPro.NotificationManagement.EntityFrameworkCore\Lion.AbpPro.NotificationManagement.EntityFrameworkCore.csproj" />
</ItemGroup>
<ItemGroup>
<Compile Remove="Logs\**" />
<Content Remove="Logs\**" />
<EmbeddedResource Remove="Logs\**" />
<None Remove="Logs\**" />
</ItemGroup>
</Project>

162
aspnet-core/modules/NotificationManagement/host/Lion.AbpPro.NotificationManagement.HttpApi.Host/Migrations/20220702015410_Init.Designer.cs

@ -0,0 +1,162 @@
// <auto-generated />
using System;
using Lion.AbpPro.NotificationManagement.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Volo.Abp.EntityFrameworkCore;
#nullable disable
namespace Lion.AbpPro.NotificationManagement.Migrations
{
[DbContext(typeof(NotificationManagementHttpApiHostMigrationsDbContext))]
[Migration("20220702015410_Init")]
partial class Init
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.MySql)
.HasAnnotation("ProductVersion", "6.0.6")
.HasAnnotation("Relational:MaxIdentifierLength", 64);
modelBuilder.Entity("Lion.AbpPro.NotificationManagement.Notifications.Aggregates.Notification", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("char(36)");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasMaxLength(40)
.HasColumnType("varchar(40)")
.HasColumnName("ConcurrencyStamp");
b.Property<string>("Content")
.IsRequired()
.HasMaxLength(1024)
.HasColumnType("varchar(1024)");
b.Property<DateTime>("CreationTime")
.HasColumnType("datetime(6)")
.HasColumnName("CreationTime");
b.Property<Guid?>("CreatorId")
.HasColumnType("char(36)")
.HasColumnName("CreatorId");
b.Property<Guid?>("DeleterId")
.HasColumnType("char(36)")
.HasColumnName("DeleterId");
b.Property<DateTime?>("DeletionTime")
.HasColumnType("datetime(6)")
.HasColumnName("DeletionTime");
b.Property<string>("ExtraProperties")
.HasColumnType("longtext")
.HasColumnName("ExtraProperties");
b.Property<bool>("IsDeleted")
.ValueGeneratedOnAdd()
.HasColumnType("tinyint(1)")
.HasDefaultValue(false)
.HasColumnName("IsDeleted");
b.Property<DateTime?>("LastModificationTime")
.HasColumnType("datetime(6)")
.HasColumnName("LastModificationTime");
b.Property<Guid?>("LastModifierId")
.HasColumnType("char(36)")
.HasColumnName("LastModifierId");
b.Property<int>("MessageType")
.HasColumnType("int");
b.Property<Guid>("SenderId")
.HasColumnType("char(36)");
b.Property<string>("Title")
.IsRequired()
.HasMaxLength(256)
.HasColumnType("varchar(256)");
b.HasKey("Id");
b.ToTable("Notification", (string)null);
});
modelBuilder.Entity("Lion.AbpPro.NotificationManagement.Notifications.Aggregates.NotificationSubscription", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("char(36)");
b.Property<DateTime>("CreationTime")
.HasColumnType("datetime(6)")
.HasColumnName("CreationTime");
b.Property<Guid?>("CreatorId")
.HasColumnType("char(36)")
.HasColumnName("CreatorId");
b.Property<Guid?>("DeleterId")
.HasColumnType("char(36)")
.HasColumnName("DeleterId");
b.Property<DateTime?>("DeletionTime")
.HasColumnType("datetime(6)")
.HasColumnName("DeletionTime");
b.Property<bool>("IsDeleted")
.ValueGeneratedOnAdd()
.HasColumnType("tinyint(1)")
.HasDefaultValue(false)
.HasColumnName("IsDeleted");
b.Property<DateTime?>("LastModificationTime")
.HasColumnType("datetime(6)")
.HasColumnName("LastModificationTime");
b.Property<Guid?>("LastModifierId")
.HasColumnType("char(36)")
.HasColumnName("LastModifierId");
b.Property<Guid?>("NotificationId")
.HasColumnType("char(36)");
b.Property<bool>("Read")
.HasColumnType("tinyint(1)");
b.Property<DateTime?>("ReadTime")
.HasColumnType("datetime(6)");
b.Property<Guid>("ReceiveId")
.HasColumnType("char(36)");
b.HasKey("Id");
b.HasIndex("NotificationId");
b.ToTable("NotificationSubscription", (string)null);
});
modelBuilder.Entity("Lion.AbpPro.NotificationManagement.Notifications.Aggregates.NotificationSubscription", b =>
{
b.HasOne("Lion.AbpPro.NotificationManagement.Notifications.Aggregates.Notification", null)
.WithMany("NotificationSubscriptions")
.HasForeignKey("NotificationId");
});
modelBuilder.Entity("Lion.AbpPro.NotificationManagement.Notifications.Aggregates.Notification", b =>
{
b.Navigation("NotificationSubscriptions");
});
#pragma warning restore 612, 618
}
}
}

87
aspnet-core/modules/NotificationManagement/host/Lion.AbpPro.NotificationManagement.HttpApi.Host/Migrations/20220702015410_Init.cs

@ -0,0 +1,87 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Lion.AbpPro.NotificationManagement.Migrations
{
public partial class Init : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterDatabase()
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "Notification",
columns: table => new
{
Id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
Title = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
Content = table.Column<string>(type: "varchar(1024)", maxLength: 1024, nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
MessageType = table.Column<int>(type: "int", nullable: false),
SenderId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
ExtraProperties = table.Column<string>(type: "longtext", nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
ConcurrencyStamp = table.Column<string>(type: "varchar(40)", maxLength: 40, nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
CreationTime = table.Column<DateTime>(type: "datetime(6)", nullable: false),
CreatorId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
LastModificationTime = table.Column<DateTime>(type: "datetime(6)", nullable: true),
LastModifierId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
IsDeleted = table.Column<bool>(type: "tinyint(1)", nullable: false, defaultValue: false),
DeleterId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
DeletionTime = table.Column<DateTime>(type: "datetime(6)", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Notification", x => x.Id);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "NotificationSubscription",
columns: table => new
{
Id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
ReceiveId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
Read = table.Column<bool>(type: "tinyint(1)", nullable: false),
ReadTime = table.Column<DateTime>(type: "datetime(6)", nullable: true),
NotificationId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
CreationTime = table.Column<DateTime>(type: "datetime(6)", nullable: false),
CreatorId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
LastModificationTime = table.Column<DateTime>(type: "datetime(6)", nullable: true),
LastModifierId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
IsDeleted = table.Column<bool>(type: "tinyint(1)", nullable: false, defaultValue: false),
DeleterId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
DeletionTime = table.Column<DateTime>(type: "datetime(6)", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_NotificationSubscription", x => x.Id);
table.ForeignKey(
name: "FK_NotificationSubscription_Notification_NotificationId",
column: x => x.NotificationId,
principalTable: "Notification",
principalColumn: "Id");
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateIndex(
name: "IX_NotificationSubscription_NotificationId",
table: "NotificationSubscription",
column: "NotificationId");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "NotificationSubscription");
migrationBuilder.DropTable(
name: "Notification");
}
}
}

160
aspnet-core/modules/NotificationManagement/host/Lion.AbpPro.NotificationManagement.HttpApi.Host/Migrations/NotificationManagementHttpApiHostMigrationsDbContextModelSnapshot.cs

@ -0,0 +1,160 @@
// <auto-generated />
using System;
using Lion.AbpPro.NotificationManagement.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Volo.Abp.EntityFrameworkCore;
#nullable disable
namespace Lion.AbpPro.NotificationManagement.Migrations
{
[DbContext(typeof(NotificationManagementHttpApiHostMigrationsDbContext))]
partial class NotificationManagementHttpApiHostMigrationsDbContextModelSnapshot : ModelSnapshot
{
protected override void BuildModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.MySql)
.HasAnnotation("ProductVersion", "6.0.6")
.HasAnnotation("Relational:MaxIdentifierLength", 64);
modelBuilder.Entity("Lion.AbpPro.NotificationManagement.Notifications.Aggregates.Notification", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("char(36)");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasMaxLength(40)
.HasColumnType("varchar(40)")
.HasColumnName("ConcurrencyStamp");
b.Property<string>("Content")
.IsRequired()
.HasMaxLength(1024)
.HasColumnType("varchar(1024)");
b.Property<DateTime>("CreationTime")
.HasColumnType("datetime(6)")
.HasColumnName("CreationTime");
b.Property<Guid?>("CreatorId")
.HasColumnType("char(36)")
.HasColumnName("CreatorId");
b.Property<Guid?>("DeleterId")
.HasColumnType("char(36)")
.HasColumnName("DeleterId");
b.Property<DateTime?>("DeletionTime")
.HasColumnType("datetime(6)")
.HasColumnName("DeletionTime");
b.Property<string>("ExtraProperties")
.HasColumnType("longtext")
.HasColumnName("ExtraProperties");
b.Property<bool>("IsDeleted")
.ValueGeneratedOnAdd()
.HasColumnType("tinyint(1)")
.HasDefaultValue(false)
.HasColumnName("IsDeleted");
b.Property<DateTime?>("LastModificationTime")
.HasColumnType("datetime(6)")
.HasColumnName("LastModificationTime");
b.Property<Guid?>("LastModifierId")
.HasColumnType("char(36)")
.HasColumnName("LastModifierId");
b.Property<int>("MessageType")
.HasColumnType("int");
b.Property<Guid>("SenderId")
.HasColumnType("char(36)");
b.Property<string>("Title")
.IsRequired()
.HasMaxLength(256)
.HasColumnType("varchar(256)");
b.HasKey("Id");
b.ToTable("Notification", (string)null);
});
modelBuilder.Entity("Lion.AbpPro.NotificationManagement.Notifications.Aggregates.NotificationSubscription", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("char(36)");
b.Property<DateTime>("CreationTime")
.HasColumnType("datetime(6)")
.HasColumnName("CreationTime");
b.Property<Guid?>("CreatorId")
.HasColumnType("char(36)")
.HasColumnName("CreatorId");
b.Property<Guid?>("DeleterId")
.HasColumnType("char(36)")
.HasColumnName("DeleterId");
b.Property<DateTime?>("DeletionTime")
.HasColumnType("datetime(6)")
.HasColumnName("DeletionTime");
b.Property<bool>("IsDeleted")
.ValueGeneratedOnAdd()
.HasColumnType("tinyint(1)")
.HasDefaultValue(false)
.HasColumnName("IsDeleted");
b.Property<DateTime?>("LastModificationTime")
.HasColumnType("datetime(6)")
.HasColumnName("LastModificationTime");
b.Property<Guid?>("LastModifierId")
.HasColumnType("char(36)")
.HasColumnName("LastModifierId");
b.Property<Guid?>("NotificationId")
.HasColumnType("char(36)");
b.Property<bool>("Read")
.HasColumnType("tinyint(1)");
b.Property<DateTime?>("ReadTime")
.HasColumnType("datetime(6)");
b.Property<Guid>("ReceiveId")
.HasColumnType("char(36)");
b.HasKey("Id");
b.HasIndex("NotificationId");
b.ToTable("NotificationSubscription", (string)null);
});
modelBuilder.Entity("Lion.AbpPro.NotificationManagement.Notifications.Aggregates.NotificationSubscription", b =>
{
b.HasOne("Lion.AbpPro.NotificationManagement.Notifications.Aggregates.Notification", null)
.WithMany("NotificationSubscriptions")
.HasForeignKey("NotificationId");
});
modelBuilder.Entity("Lion.AbpPro.NotificationManagement.Notifications.Aggregates.Notification", b =>
{
b.Navigation("NotificationSubscriptions");
});
#pragma warning restore 612, 618
}
}
}

253
aspnet-core/modules/NotificationManagement/host/Lion.AbpPro.NotificationManagement.HttpApi.Host/NotificationManagementHttpApiHostModule.cs

@ -0,0 +1,253 @@
using System;
using System.Linq;
using Lion.AbpPro.CAP;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Cors;
using Microsoft.AspNetCore.DataProtection;
using Microsoft.Extensions.Caching.Distributed;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.OpenApi.Models;
using Lion.AbpPro.NotificationManagement.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Hosting;
using Savorboard.CAP.InMemoryMessageQueue;
using StackExchange.Redis;
using Swashbuckle.AspNetCore.SwaggerUI;
using Volo.Abp;
using Volo.Abp.AspNetCore.Mvc.AntiForgery;
using Volo.Abp.AspNetCore.Serilog;
using Volo.Abp.Autofac;
using Volo.Abp.Caching;
using Volo.Abp.Caching.StackExchangeRedis;
using Volo.Abp.EntityFrameworkCore;
using Volo.Abp.EntityFrameworkCore.MySQL;
using Volo.Abp.Localization;
using Volo.Abp.Modularity;
using Volo.Abp.Swashbuckle;
using Volo.Abp.VirtualFileSystem;
namespace Lion.AbpPro.NotificationManagement;
[DependsOn(
typeof(NotificationManagementApplicationModule),
typeof(NotificationManagementEntityFrameworkCoreModule),
typeof(NotificationManagementHttpApiModule),
typeof(AbpAutofacModule),
typeof(AbpCachingStackExchangeRedisModule),
typeof(AbpAspNetCoreSerilogModule),
typeof(AbpSwashbuckleModule),
typeof(AbpProAbpCapModule),
typeof(AbpEntityFrameworkCoreMySQLModule)
)]
public class NotificationManagementHttpApiHostModule : AbpModule
{
private const string DefaultCorsPolicyName = "Default";
public override void ConfigureServices(ServiceConfigurationContext context)
{
ConfigureVirtualFileSystem();
ConfigureSwaggerServices(context);
ConfigAntiForgery();
ConfigureLocalization();
ConfigureCap(context);
ConfigureCache(context);
ConfigureCors(context);
ConfigDB();
}
public override void OnApplicationInitialization(ApplicationInitializationContext context)
{
var app = context.GetApplicationBuilder();
var env = context.GetEnvironment();
app.UseCorrelationId();
app.UseStaticFiles();
app.UseRouting();
app.UseCors(DefaultCorsPolicyName);
app.UseAuthentication();
app.UseAbpRequestLocalization();
app.UseAuthorization();
app.UseSwagger();
app.UseAbpSwaggerUI(options =>
{
options.SwaggerEndpoint("/swagger/v1/swagger.json", "NotificationManagement API");
options.DocExpansion(DocExpansion.None);
options.DefaultModelExpandDepth(-2);
});
app.UseAuditing();
app.UseAbpSerilogEnrichers();
app.UseConfiguredEndpoints();
}
/// <summary>
/// 配置虚拟文件系统
/// </summary>
private void ConfigureVirtualFileSystem()
{
Configure<AbpVirtualFileSystemOptions>(options => { options.FileSets.AddEmbedded<NotificationManagementHttpApiHostModule>(); });
}
private void ConfigDB()
{
Configure<AbpDbContextOptions>(options =>
{
/* The main point to change your DBMS.
* See also OperationsMigrationsDbContextFactory for EF Core tooling. */
options.UseMySQL();
});
}
private void ConfigureCap(ServiceConfigurationContext context)
{
var configuration = context.Services.GetConfiguration();
var enabled = configuration.GetValue("Cap:Enabled", false);
if (enabled)
{
context.AddAbpCap(capOptions =>
{
capOptions.UseEntityFramework<NotificationManagementHttpApiHostMigrationsDbContext>();
capOptions.UseRabbitMQ(option =>
{
option.HostName = configuration.GetValue<string>("Cap:RabbitMq:HostName");
option.UserName = configuration.GetValue<string>("Cap:RabbitMq:UserName");
option.Password = configuration.GetValue<string>("Cap:RabbitMq:Password");
});
var hostingEnvironment = context.Services.GetHostingEnvironment();
bool auth = !hostingEnvironment.IsDevelopment();
capOptions.UseDashboard(options => { options.UseAuth = auth; });
});
}
else
{
context.AddAbpCap(capOptions =>
{
capOptions.UseInMemoryStorage();
capOptions.UseInMemoryMessageQueue();
var hostingEnvironment = context.Services.GetHostingEnvironment();
bool auth = !hostingEnvironment.IsDevelopment();
capOptions.UseDashboard(options => { options.UseAuth = auth; });
});
}
}
/// <summary>
/// 配置SwaggerUI
/// </summary>
/// <param name="context"></param>
private static void ConfigureSwaggerServices(ServiceConfigurationContext context)
{
context.Services.AddSwaggerGen(
options =>
{
options.SwaggerDoc("v1", new OpenApiInfo { Title = "NotificationManagement API", Version = "v1" });
options.DocInclusionPredicate((docName, description) => true);
#region 多语言
options.AddSecurityDefinition("ApiKey", new OpenApiSecurityScheme
{
Type = SecuritySchemeType.ApiKey,
In = ParameterLocation.Header,
Name = "Accept-Language",
Description = "多语言"
});
options.AddSecurityRequirement(new OpenApiSecurityRequirement
{
{
new OpenApiSecurityScheme
{
Reference = new OpenApiReference { Type = ReferenceType.SecurityScheme, Id = "ApiKey" }
},
new string[] { }
}
});
#endregion
});
}
private void ConfigAntiForgery()
{
Configure<AbpAntiForgeryOptions>(options => { options.AutoValidate = false; });
}
/// <summary>
/// 配置本地化
/// </summary>
private void ConfigureLocalization()
{
Configure<AbpLocalizationOptions>(options =>
{
options.Languages.Add(new LanguageInfo("ar", "ar", "العربية"));
options.Languages.Add(new LanguageInfo("cs", "cs", "Čeština"));
options.Languages.Add(new LanguageInfo("en", "en", "English"));
options.Languages.Add(new LanguageInfo("en-GB", "en-GB", "English (UK)"));
options.Languages.Add(new LanguageInfo("fi", "fi", "Finnish"));
options.Languages.Add(new LanguageInfo("fr", "fr", "Français"));
options.Languages.Add(new LanguageInfo("hi", "hi", "Hindi", "in"));
options.Languages.Add(new LanguageInfo("is", "is", "Icelandic", "is"));
options.Languages.Add(new LanguageInfo("it", "it", "Italiano", "it"));
options.Languages.Add(new LanguageInfo("hu", "hu", "Magyar"));
options.Languages.Add(new LanguageInfo("pt-BR", "pt-BR", "Português"));
options.Languages.Add(new LanguageInfo("ro-RO", "ro-RO", "Română"));
options.Languages.Add(new LanguageInfo("ru", "ru", "Русский"));
options.Languages.Add(new LanguageInfo("sk", "sk", "Slovak"));
options.Languages.Add(new LanguageInfo("tr", "tr", "Türkçe"));
options.Languages.Add(new LanguageInfo("zh-Hans", "zh-Hans", "简体中文"));
options.Languages.Add(new LanguageInfo("zh-Hant", "zh-Hant", "繁體中文"));
options.Languages.Add(new LanguageInfo("de-DE", "de-DE", "Deutsch"));
options.Languages.Add(new LanguageInfo("es", "es", "Español"));
});
}
/// <summary>
/// Redis缓存
/// </summary>
/// <param name="context"></param>
private void ConfigureCache(ServiceConfigurationContext context)
{
Configure<AbpDistributedCacheOptions>(options =>
{
options.KeyPrefix = "NotificationManagement:";
options.GlobalCacheEntryOptions = new DistributedCacheEntryOptions
{
// 全局缓存有效时间
AbsoluteExpiration = DateTimeOffset.UtcNow.AddHours(2)
};
});
var configuration = context.Services.GetConfiguration();
var redis = ConnectionMultiplexer.Connect(configuration["Redis:Configuration"]);
context.Services
.AddDataProtection()
.PersistKeysToStackExchangeRedis(redis, "YH.Wms.Operations-Keys");
}
/// <summary>
/// 配置跨域
/// </summary>
private void ConfigureCors(ServiceConfigurationContext context)
{
var configuration = context.Services.GetConfiguration();
context.Services.AddCors(options =>
{
options.AddPolicy(DefaultCorsPolicyName, builder =>
{
builder
.WithOrigins(
configuration["App:CorsOrigins"]
.Split(",", StringSplitOptions.RemoveEmptyEntries)
.Select(o => o.RemovePostFix("/"))
.ToArray()
)
.WithAbpExposedHeaders()
.SetIsOriginAllowedToAllowWildcardSubdomains()
.AllowAnyHeader()
.AllowAnyMethod()
.AllowCredentials();
});
});
}
}

24
aspnet-core/modules/NotificationManagement/host/Lion.AbpPro.NotificationManagement.HttpApi.Host/Program.cs

@ -0,0 +1,24 @@
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Hosting;
using Serilog;
namespace Lion.AbpPro.NotificationManagement;
public class Program
{
public static void Main(string[] args)
{
CreateHostBuilder(args).Build().Run();
}
public static IHostBuilder CreateHostBuilder(string[] args)
{
return Host.CreateDefaultBuilder(args)
.ConfigureWebHostDefaults(webBuilder =>
{
webBuilder.ConfigureKestrel((context, options) => { options.Limits.MaxRequestBodySize = 1024 * 50; });
webBuilder.UseStartup<Startup>();
})
.UseSerilog().UseAutofac();
}
}

12
aspnet-core/modules/NotificationManagement/host/Lion.AbpPro.NotificationManagement.HttpApi.Host/Properties/launchSettings.json

@ -0,0 +1,12 @@
{
"profiles": {
"Lion.AbpPro.NotificationManagement.HttpApi.Host": {
"commandName": "Project",
"launchBrowser": true,
"applicationUrl": "http://localhost:5001",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
}

19
aspnet-core/modules/NotificationManagement/host/Lion.AbpPro.NotificationManagement.HttpApi.Host/Startup.cs

@ -0,0 +1,19 @@
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
namespace Lion.AbpPro.NotificationManagement;
public class Startup
{
public void ConfigureServices(IServiceCollection services)
{
services.AddApplication<NotificationManagementHttpApiHostModule>();
}
public void Configure(IApplicationBuilder app, IWebHostEnvironment env, ILoggerFactory loggerFactory)
{
app.InitializeApplication();
}
}

20
aspnet-core/modules/NotificationManagement/host/Lion.AbpPro.NotificationManagement.HttpApi.Host/appsettings.json

@ -0,0 +1,20 @@
{
"App": {
"CorsOrigins": "https://*.NotificationManagement.com,http://localhost:4200,http://localhost:44307,https://localhost:44307"
},
"ConnectionStrings": {
"Default": "Data Source=localhost;Database=LionAbpProDB;uid=root;pwd=mypassword;charset=utf8mb4;Allow User Variables=true;AllowLoadLocalInfile=true",
"NotificationManagement":"Data Source=localhost;Database=NotificationManagement;uid=root;pwd=1q2w3E*;charset=utf8mb4;Allow User Variables=true;AllowLoadLocalInfile=true"
},
"Redis": {
"Configuration": "localhost,password=mypassword,defaultdatabase=1"
},
"Cap": {
"Enabled": "false",
"RabbitMq": {
"HostName": "localhost",
"UserName": "admin",
"Password": "1q2w3E*"
}
}
}

2
aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Domain/Notifications/Aggregates/Notification.cs

@ -13,7 +13,7 @@ namespace Lion.AbpPro.NotificationManagement.Notifications.Aggregates
/// <summary>
/// 消息通知
/// </summary>
public partial class Notification : FullAuditedAggregateRoot<Guid>
public class Notification : FullAuditedAggregateRoot<Guid>
{
/// <summary>
/// 消息标题

2
aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Domain/Notifications/NotificationManager.cs

@ -50,7 +50,7 @@ namespace Lion.AbpPro.NotificationManagement.Notifications
var notificationEto = ObjectMapper.Map<Notification, NotificationEto>(entity);
// 发送集成事件
entity.AddCreatedNotificationDistributedEvent(new CreatedNotificationDistributedEvent(notificationEto));
return entity = await _notificationRepository.InsertAsync(entity);
return await _notificationRepository.InsertAsync(entity);
}
/// <summary>

79
aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/AbpProHttpApiHostModule.cs

@ -1,48 +1,3 @@
using Lion.AbpPro.ConfigurationOptions;
using Lion.AbpPro.EntityFrameworkCore;
using Lion.AbpPro.MultiTenancy;
using Hangfire;
using Hangfire.MySql;
using Microsoft.AspNetCore.Authentication.JwtBearer;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.DataProtection;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.IdentityModel.Tokens;
using Microsoft.OpenApi.Models;
using Savorboard.CAP.InMemoryMessageQueue;
using StackExchange.Redis;
using Swashbuckle.AspNetCore.SwaggerUI;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Lion.AbpPro.CAP;
using Lion.AbpPro.Extensions;
using Lion.AbpPro.Extensions.Hangfire;
using Lion.AbpPro.Shared.Hosting.Microservices;
using Lion.AbpPro.Shared.Hosting.Microservices.Microsoft.AspNetCore.Builder;
using Lion.AbpPro.Shared.Hosting.Microservices.Microsoft.AspNetCore.MVC.Filters;
using Lion.AbpPro.Shared.Hosting.Microservices.Swaggers;
using Volo.Abp;
using Volo.Abp.Account.Web;
using Volo.Abp.AspNetCore.Authentication.JwtBearer;
using Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy;
using Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic;
using Volo.Abp.AspNetCore.Serilog;
using Volo.Abp.BackgroundJobs;
using Volo.Abp.BackgroundJobs.Hangfire;
using Volo.Abp.Caching;
using Volo.Abp.Caching.StackExchangeRedis;
using Volo.Abp.Modularity;
using Microsoft.AspNetCore.Mvc;
using Magicodes.ExporterAndImporter.Core;
using Magicodes.ExporterAndImporter.Excel;
using Microsoft.AspNetCore.Identity;
namespace Lion.AbpPro
{
[DependsOn(
@ -82,6 +37,8 @@ namespace Lion.AbpPro
ConfigureMagicodes(context);
ConfigureAbpExceptions(context);
ConfigureIdentity(context);
ConfigureCap(context);
ConfigureAuditLog(context);
}
public override void OnApplicationInitialization(ApplicationInitializationContext context)
@ -317,14 +274,6 @@ namespace Lion.AbpPro
context.Services.Configure<IdentityOptions>(options => { options.Lockout = new LockoutOptions() { AllowedForNewUsers = false }; });
}
// private void ConfigureConventionalControllers()
// {
// Configure<AbpAspNetCoreMvcOptions>(options =>
// {
// options.ConventionalControllers.Create(typeof(AbpProApplicationModule).Assembly);
// });
// }
private static void ConfigureSwaggerServices(ServiceConfigurationContext context)
{
context.Services.AddSwaggerGen(
@ -426,5 +375,29 @@ namespace Lion.AbpPro
});
}
}
/// <summary>
/// 审计日志
/// </summary>
private void ConfigureAuditLog(ServiceConfigurationContext context)
{
Configure<AbpAuditingOptions>
(
options =>
{
options.IsEnabled = true;
options.EntityHistorySelectors.AddAllEntities();
options.ApplicationName = "Lion.AbpPro";
}
);
Configure<AbpAspNetCoreAuditingOptions>(
options =>
{
options.IgnoredUrls.Add("/AuditLogs/page");
options.IgnoredUrls.Add("/hangfire/stats");
options.IgnoredUrls.Add("/cap");
});
}
}
}

3
aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/Controllers/HomeController.cs

@ -1,6 +1,3 @@
using Microsoft.AspNetCore.Mvc;
using Volo.Abp.AspNetCore.Mvc;
namespace Lion.AbpPro.Controllers
{
public class HomeController : AbpController

7
aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/Extensions/Hangfire/AutoDeleteAfterSuccessAttributer.cs

@ -1,9 +1,4 @@
using System;
using Hangfire.Common;
using Hangfire.States;
using Hangfire.Storage;
namespace Lion.AbpPro.Extensions.Hangfire;
namespace Lion.AbpPro.Extensions.Hangfire;
public class AutoDeleteAfterSuccessAttributer : JobFilterAttribute, IApplyStateFilter
{

3
aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/Extensions/Hangfire/CronType.cs

@ -1,6 +1,3 @@
using System;
using Hangfire;
namespace Lion.AbpPro.Extensions.Hangfire
{
/// <summary>

4
aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/Extensions/Hangfire/CustomHangfireAuthorizeFilter.cs

@ -1,7 +1,3 @@
using Hangfire.Dashboard;
using Microsoft.Extensions.DependencyInjection;
using Volo.Abp.Users;
namespace Lion.AbpPro.Extensions.Hangfire
{
public class CustomHangfireAuthorizeFilter : IDashboardAuthorizationFilter

6
aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/Extensions/Hangfire/JobRetryLastFilter.cs

@ -1,8 +1,4 @@
using Hangfire.Common;
using Hangfire.States;
using Serilog;
namespace Lion.AbpPro.Extensions.Hangfire;
namespace Lion.AbpPro.Extensions.Hangfire;
/// <summary>
/// 重试最后一次

23
aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/Extensions/MVC/Filters/ResultExceptionFilter.cs

@ -1,26 +1,3 @@
using System;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Lion.AbpPro.Extension.Customs.Dtos;
using Lion.AbpPro.Extensions.System;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Abstractions;
using Microsoft.AspNetCore.Mvc.Filters;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Logging.Abstractions;
using Microsoft.Extensions.Options;
using Volo.Abp;
using Volo.Abp.AspNetCore.ExceptionHandling;
using Volo.Abp.Authorization;
using Volo.Abp.DependencyInjection;
using Volo.Abp.Domain.Entities;
using Volo.Abp.ExceptionHandling;
using Volo.Abp.Http;
using Volo.Abp.Json;
using Volo.Abp.Validation;
namespace Lion.AbpPro.Shared.Hosting.Microservices.Microsoft.AspNetCore.MVC.Filters
{
public sealed class ResultExceptionFilter : IFilterMetadata, IAsyncExceptionFilter, ITransientDependency

4
aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/Extensions/Middlewares/AbpProApplicationBuilderExtensionsExtensions.cs

@ -1,6 +1,4 @@
using Lion.AbpPro.Extensions.Middlewares;
namespace Microsoft.AspNetCore.Builder;
namespace Microsoft.AspNetCore.Builder;
public static class AbpProApplicationBuilderExtensionsExtensions
{

9
aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/Extensions/Middlewares/RequestLogMiddleware.cs

@ -1,11 +1,4 @@
using System;
using System.IO;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Logging;
namespace Lion.AbpPro.Extensions.Middlewares;
namespace Lion.AbpPro.Extensions.Middlewares;
public class RequestLogMiddleware
{

5
aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/Extensions/RecurringJobsExtensions.cs

@ -1,9 +1,4 @@
using System;
using Hangfire;
using Lion.AbpPro.Extensions.Hangfire;
using Lion.AbpPro.Jobs;
using Microsoft.Extensions.DependencyInjection;
using Volo.Abp;
namespace Lion.AbpPro.Extensions
{

7
aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/Extensions/SerilogToEsExtensions.cs

@ -1,12 +1,5 @@
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Configuration;
using Serilog;
using Serilog.Exceptions;
using Serilog.Sinks.Elasticsearch;
using System;
using System.IO;
using System.Text;
using System.Threading.Tasks;
namespace Lion.AbpPro.Extensions
{

4
aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/Extensions/System/WrapResultAttribute.cs

@ -1,6 +1,4 @@
using System;
namespace Lion.AbpPro.Extensions.System
namespace Lion.AbpPro.Extensions.System
{
public class WrapResultAttribute : Attribute
{

76
aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/GlobalUsings.cs

@ -0,0 +1,76 @@
// Global using directives
global using System;
global using System.Collections.Generic;
global using System.IO;
global using System.Linq;
global using System.Text;
global using System.Text.RegularExpressions;
global using System.Threading.Tasks;
global using Hangfire;
global using Hangfire.Common;
global using Hangfire.Dashboard;
global using Hangfire.MySql;
global using Hangfire.States;
global using Hangfire.Storage;
global using Lion.AbpPro.CAP;
global using Lion.AbpPro.ConfigurationOptions;
global using Lion.AbpPro.EntityFrameworkCore;
global using Lion.AbpPro.Extension.Customs.Dtos;
global using Lion.AbpPro.Extensions;
global using Lion.AbpPro.Extensions.Hangfire;
global using Lion.AbpPro.Extensions.Middlewares;
global using Lion.AbpPro.Extensions.System;
global using Lion.AbpPro.Localization;
global using Lion.AbpPro.MultiTenancy;
global using Lion.AbpPro.Shared.Hosting.Microservices;
global using Lion.AbpPro.Shared.Hosting.Microservices.Microsoft.AspNetCore.Builder;
global using Lion.AbpPro.Shared.Hosting.Microservices.Microsoft.AspNetCore.MVC.Filters;
global using Lion.AbpPro.Shared.Hosting.Microservices.Swaggers;
global using Magicodes.ExporterAndImporter.Core;
global using Magicodes.ExporterAndImporter.Excel;
global using Microsoft.AspNetCore.Authentication.JwtBearer;
global using Microsoft.AspNetCore.Builder;
global using Microsoft.AspNetCore.DataProtection;
global using Microsoft.AspNetCore.Hosting;
global using Microsoft.AspNetCore.Http;
global using Microsoft.AspNetCore.Identity;
global using Microsoft.AspNetCore.Mvc;
global using Microsoft.AspNetCore.Mvc.Abstractions;
global using Microsoft.AspNetCore.Mvc.Filters;
global using Microsoft.Extensions.Configuration;
global using Microsoft.Extensions.DependencyInjection;
global using Microsoft.Extensions.Hosting;
global using Microsoft.Extensions.Logging;
global using Microsoft.Extensions.Logging.Abstractions;
global using Microsoft.Extensions.Options;
global using Microsoft.IdentityModel.Tokens;
global using Microsoft.OpenApi.Models;
global using Savorboard.CAP.InMemoryMessageQueue;
global using Serilog;
global using Serilog.Events;
global using StackExchange.Redis;
global using Swashbuckle.AspNetCore.SwaggerUI;
global using Volo.Abp;
global using Volo.Abp.Account.Web;
global using Volo.Abp.AspNetCore.Auditing;
global using Volo.Abp.AspNetCore.Authentication.JwtBearer;
global using Volo.Abp.AspNetCore.ExceptionHandling;
global using Volo.Abp.AspNetCore.Mvc;
global using Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy;
global using Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic;
global using Volo.Abp.AspNetCore.Serilog;
global using Volo.Abp.Auditing;
global using Volo.Abp.Authorization;
global using Volo.Abp.BackgroundJobs;
global using Volo.Abp.BackgroundJobs.Hangfire;
global using Volo.Abp.Caching;
global using Volo.Abp.Caching.StackExchangeRedis;
global using Volo.Abp.DependencyInjection;
global using Volo.Abp.Domain.Entities;
global using Volo.Abp.ExceptionHandling;
global using Volo.Abp.Http;
global using Volo.Abp.Json;
global using Volo.Abp.Modularity;
global using Volo.Abp.Users;
global using Volo.Abp.Validation;

7
aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/Pages/Login.cshtml.cs

@ -1,13 +1,6 @@
using System;
using System.Threading.Tasks;
using Lion.AbpPro.ConfigurationOptions;
using Lion.AbpPro.Users;
using Lion.AbpPro.Users.Dtos;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
namespace Lion.AbpPro.Pages

9
aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/Program.cs

@ -1,12 +1,3 @@
using System;
using System.IO;
using Lion.AbpPro.Extensions;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Hosting;
using Serilog;
using Serilog.Events;
namespace Lion.AbpPro
{
public class Program

6
aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/Startup.cs

@ -1,9 +1,3 @@
using Lion.AbpPro.Localization;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
namespace Lion.AbpPro
{
public class Startup

4
aspnet-core/services/src/Lion.AbpPro.Application/Roles/RolePermissionAppService.cs

@ -65,11 +65,10 @@ namespace Lion.AbpPro.Roles
};
var permissions = new List<PermissionTreeDto>();
foreach (var group in input)
{
if (excludes.Any(e => e == group.Name)) continue;
// 获取分组信息
var groupPermission = new PermissionTreeDto
{
@ -93,7 +92,6 @@ namespace Lion.AbpPro.Roles
var childTreeMenu = RecursionMenu(group.Permissions, null);
groupPermission.Children.AddRange(childTreeMenu.Children);
permissions.Add(groupPermission);
}

38
aspnet-core/services/src/Lion.AbpPro.Application/Users/UserAppService.cs

@ -15,11 +15,8 @@ using Microsoft.Extensions.Options;
using Volo.Abp;
using Volo.Abp.Account;
using Volo.Abp.Application.Dtos;
using Volo.Abp.DependencyInjection;
using Volo.Abp.EventBus;
using Volo.Abp.Identity;
using Volo.Abp.Users;
using IdentityUser = Volo.Abp.Identity.IdentityUser;
namespace Lion.AbpPro.Users
{
@ -31,22 +28,18 @@ namespace Lion.AbpPro.Users
private readonly IIdentityUserRepository _identityUserRepository;
private readonly IExcelExporter _excelExporter;
private readonly IOptions<IdentityOptions> _options;
private readonly IBulkImportUserRepository _bulkImportUserRepository;
public UserAppService(
IIdentityUserAppService identityUserAppService,
IdentityUserManager userManager,
IIdentityUserRepository userRepository,
IExcelExporter excelExporter,
IOptions<IdentityOptions> options,
NotificationManager notificationManager,
IBulkImportUserRepository bulkImportUserRepository)
IOptions<IdentityOptions> options)
{
_identityUserAppService = identityUserAppService;
_userManager = userManager;
_identityUserRepository = userRepository;
_excelExporter = excelExporter;
_options = options;
_bulkImportUserRepository = bulkImportUserRepository;
}
/// <summary>
@ -64,8 +57,8 @@ namespace Lion.AbpPro.Users
Sorting = " LastModificationTime desc"
};
long count = await _identityUserRepository.GetCountAsync(request.Filter);
List<Volo.Abp.Identity.IdentityUser> source = await _identityUserRepository
var count = await _identityUserRepository.GetCountAsync(request.Filter);
var source = await _identityUserRepository
.GetListAsync(request.Sorting, request.MaxResultCount, request.SkipCount, request.Filter);
return new PagedResultDto<IdentityUserDto>(count,
@ -86,7 +79,7 @@ namespace Lion.AbpPro.Users
SkipCount = input.SkipCount,
Sorting = " LastModificationTime desc"
};
List<Volo.Abp.Identity.IdentityUser> source = await _identityUserRepository
var source = await _identityUserRepository
.GetListAsync(request.Sorting, request.MaxResultCount, request.SkipCount, request.Filter);
var result = ObjectMapper.Map<List<Volo.Abp.Identity.IdentityUser>, List<ExportIdentityUserOutput>>(source);
var bytes = await _excelExporter.ExportAsByteArray<ExportIdentityUserOutput>(result);
@ -168,26 +161,9 @@ namespace Lion.AbpPro.Users
[Authorize(AbpProPermissions.SystemManagement.UserEnable)]
public async Task LockAsync(LockUserInput input)
{
var s = new IdentityUser(Guid.NewGuid(),Guid.NewGuid().ToString(),Guid.NewGuid().ToString()+"@qq.com");
await _bulkImportUserRepository.BulkInsertAsync(new List<IdentityUser>(){s});
// throw new UserFriendlyException("Sdf");
// var identityUser = await _userManager.GetByIdAsync(input.UserId);
// identityUser.SetIsActive(input.Locked);
// await _userManager.UpdateAsync(identityUser);
var identityUser = await _userManager.GetByIdAsync(input.UserId);
identityUser.SetIsActive(input.Locked);
await _userManager.UpdateAsync(identityUser);
}
}
}
public class TestEvent
{
public string Type { get; set; }
}
public class ttt : ILocalEventHandler<TestEvent>, ITransientDependency
{
public async Task HandleEventAsync(TestEvent eventData)
{
var s = "1";
}
}

2
aspnet-core/services/src/Lion.AbpPro.EntityFrameworkCore/EntityFrameworkCore/Users/BulkImportUserRepository.cs

@ -21,8 +21,6 @@ public class BulkImportUserRepository:IBulkImportUserRepository
public async Task BulkInsertAsync(List<IdentityUser> identityUsers)
{
// TODO 这个地方创建人和创建时间需要手动赋值。
// 完美契合abp,并且能够触发领域事件和分布式事件
var context = await _contextProvider.GetDbContextAsync();
await context.BulkInsertAsync(identityUsers, context.Database.CurrentTransaction.GetDbTransaction() as MySqlTransaction);
}

1
vben271/src/views/sys/login/useLogin.ts

@ -135,7 +135,6 @@ function getOidcSettings() {
export function useOidcLogin() {
const settings = getOidcSettings();
mgr.getUser()
const mgr = new Oidc.UserManager(settings);
mgr.signinRedirect();
}

Loading…
Cancel
Save