diff --git a/aspnet-core/Directory.Build.props b/aspnet-core/Directory.Build.props index bdd2a366..4e9046c8 100644 --- a/aspnet-core/Directory.Build.props +++ b/aspnet-core/Directory.Build.props @@ -1,7 +1,7 @@  - 5.3.0 + 5.3.1 6.1.0 6.0.6 6.0.1 diff --git a/aspnet-core/Lion.AbpPro.sln b/aspnet-core/Lion.AbpPro.sln index ac19300f..2082cafa 100644 --- a/aspnet-core/Lion.AbpPro.sln +++ b/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} diff --git a/aspnet-core/modules/FileManagement/host/Lion.AbpPro.FileManagement.HttpApi.Host/FileManagementHttpApiHostModule.cs b/aspnet-core/modules/FileManagement/host/Lion.AbpPro.FileManagement.HttpApi.Host/FileManagementHttpApiHostModule.cs index c4062302..f284cb2a 100644 --- a/aspnet-core/modules/FileManagement/host/Lion.AbpPro.FileManagement.HttpApi.Host/FileManagementHttpApiHostModule.cs +++ b/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(options => { options.AutoValidate = false; }); } + private void ConfigDB() + { + Configure(options => + { + /* The main point to change your DBMS. + * See also OperationsMigrationsDbContextFactory for EF Core tooling. */ + options.UseMySQL(); + }); + } + /// /// 配置本地化 diff --git a/aspnet-core/modules/FileManagement/host/Lion.AbpPro.FileManagement.HttpApi.Host/Lion.AbpPro.FileManagement.HttpApi.Host.csproj b/aspnet-core/modules/FileManagement/host/Lion.AbpPro.FileManagement.HttpApi.Host/Lion.AbpPro.FileManagement.HttpApi.Host.csproj index 965f7bee..79427430 100644 --- a/aspnet-core/modules/FileManagement/host/Lion.AbpPro.FileManagement.HttpApi.Host/Lion.AbpPro.FileManagement.HttpApi.Host.csproj +++ b/aspnet-core/modules/FileManagement/host/Lion.AbpPro.FileManagement.HttpApi.Host/Lion.AbpPro.FileManagement.HttpApi.Host.csproj @@ -22,6 +22,7 @@ + diff --git a/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Application.Contracts/Samples/ISampleAppService.cs b/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Application.Contracts/Samples/ISampleAppService.cs deleted file mode 100644 index e1e50e95..00000000 --- a/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Application.Contracts/Samples/ISampleAppService.cs +++ /dev/null @@ -1,11 +0,0 @@ -using System.Threading.Tasks; -using Volo.Abp.Application.Services; - -namespace Lion.AbpPro.FileManagement.Samples; - -public interface ISampleAppService : IApplicationService -{ - Task GetAsync(); - - Task GetAuthorizedAsync(); -} \ No newline at end of file diff --git a/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Application.Contracts/Samples/SampleDto.cs b/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Application.Contracts/Samples/SampleDto.cs deleted file mode 100644 index 9848148c..00000000 --- a/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Application.Contracts/Samples/SampleDto.cs +++ /dev/null @@ -1,6 +0,0 @@ -namespace Lion.AbpPro.FileManagement.Samples; - -public class SampleDto -{ - public int Value { get; set; } -} \ No newline at end of file diff --git a/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Application/Samples/SampleAppService.cs b/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Application/Samples/SampleAppService.cs deleted file mode 100644 index f9f9168b..00000000 --- a/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Application/Samples/SampleAppService.cs +++ /dev/null @@ -1,28 +0,0 @@ -using System.Threading.Tasks; -using Microsoft.AspNetCore.Authorization; - -namespace Lion.AbpPro.FileManagement.Samples; - -public class SampleAppService : FileManagementAppService, ISampleAppService -{ - public Task GetAsync() - { - return Task.FromResult( - new SampleDto - { - Value = 42 - } - ); - } - - [Authorize] - public Task GetAuthorizedAsync() - { - return Task.FromResult( - new SampleDto - { - Value = 42 - } - ); - } -} \ No newline at end of file diff --git a/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.EntityFrameworkCore/EntityFrameworkCore/FileManagementEntityFrameworkCoreModule.cs b/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.EntityFrameworkCore/EntityFrameworkCore/FileManagementEntityFrameworkCoreModule.cs index 64046057..bfb77f52 100644 --- a/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.EntityFrameworkCore/EntityFrameworkCore/FileManagementEntityFrameworkCoreModule.cs +++ b/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(options => - { - /* The main point to change your DBMS. - * See also OperationsMigrationsDbContextFactory for EF Core tooling. */ - options.UseMySQL(); - }); } } \ No newline at end of file diff --git a/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.EntityFrameworkCore/Lion.AbpPro.FileManagement.EntityFrameworkCore.csproj b/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.EntityFrameworkCore/Lion.AbpPro.FileManagement.EntityFrameworkCore.csproj index e35fb1ab..76b5a404 100644 --- a/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.EntityFrameworkCore/Lion.AbpPro.FileManagement.EntityFrameworkCore.csproj +++ b/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.EntityFrameworkCore/Lion.AbpPro.FileManagement.EntityFrameworkCore.csproj @@ -8,7 +8,7 @@ - + diff --git a/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.HttpApi/Samples/SampleController.cs b/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.HttpApi/Samples/SampleController.cs deleted file mode 100644 index 9e238f67..00000000 --- a/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.HttpApi/Samples/SampleController.cs +++ /dev/null @@ -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 GetAsync() - { - return await _sampleAppService.GetAsync(); - } - - [HttpGet] - [Route("authorized")] - [Authorize] - public async Task GetAuthorizedAsync() - { - return await _sampleAppService.GetAsync(); - } -} \ No newline at end of file diff --git a/aspnet-core/modules/FileManagement/test/Lion.AbpPro.FileManagement.Application.Tests/Lion.AbpPro.FileManagement.Application.Tests.csproj b/aspnet-core/modules/FileManagement/test/Lion.AbpPro.FileManagement.Application.Tests/Lion.AbpPro.FileManagement.Application.Tests.csproj index 3fb48ce5..e8770a93 100644 --- a/aspnet-core/modules/FileManagement/test/Lion.AbpPro.FileManagement.Application.Tests/Lion.AbpPro.FileManagement.Application.Tests.csproj +++ b/aspnet-core/modules/FileManagement/test/Lion.AbpPro.FileManagement.Application.Tests/Lion.AbpPro.FileManagement.Application.Tests.csproj @@ -8,9 +8,9 @@ - - - + + + diff --git a/aspnet-core/modules/FileManagement/test/Lion.AbpPro.FileManagement.Application.Tests/Samples/SampleAppService_Tests.cs b/aspnet-core/modules/FileManagement/test/Lion.AbpPro.FileManagement.Application.Tests/Samples/SampleAppService_Tests.cs deleted file mode 100644 index 16b05bf4..00000000 --- a/aspnet-core/modules/FileManagement/test/Lion.AbpPro.FileManagement.Application.Tests/Samples/SampleAppService_Tests.cs +++ /dev/null @@ -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(); - } - - [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); - } -} \ No newline at end of file diff --git a/aspnet-core/modules/FileManagement/test/Lion.AbpPro.FileManagement.HttpApi.Client.ConsoleTestApp/ClientDemoService.cs b/aspnet-core/modules/FileManagement/test/Lion.AbpPro.FileManagement.HttpApi.Client.ConsoleTestApp/ClientDemoService.cs deleted file mode 100644 index 8cf2935b..00000000 --- a/aspnet-core/modules/FileManagement/test/Lion.AbpPro.FileManagement.HttpApi.Client.ConsoleTestApp/ClientDemoService.cs +++ /dev/null @@ -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); - } - } - } - } -} \ No newline at end of file diff --git a/aspnet-core/modules/FileManagement/test/Lion.AbpPro.FileManagement.HttpApi.Client.ConsoleTestApp/ConsoleTestAppHostedService.cs b/aspnet-core/modules/FileManagement/test/Lion.AbpPro.FileManagement.HttpApi.Client.ConsoleTestApp/ConsoleTestAppHostedService.cs deleted file mode 100644 index 67bfd1b2..00000000 --- a/aspnet-core/modules/FileManagement/test/Lion.AbpPro.FileManagement.HttpApi.Client.ConsoleTestApp/ConsoleTestAppHostedService.cs +++ /dev/null @@ -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(options=> - { - options.Services.ReplaceConfiguration(_configuration); - options.UseAutofac(); - })) - { - application.Initialize(); - - var demo = application.ServiceProvider.GetRequiredService(); - await demo.RunAsync(); - - application.Shutdown(); - } - } - - public Task StopAsync(CancellationToken cancellationToken) => Task.CompletedTask; - } -} diff --git a/aspnet-core/modules/FileManagement/test/Lion.AbpPro.FileManagement.HttpApi.Client.ConsoleTestApp/FileManagementConsoleApiClientModule.cs b/aspnet-core/modules/FileManagement/test/Lion.AbpPro.FileManagement.HttpApi.Client.ConsoleTestApp/FileManagementConsoleApiClientModule.cs deleted file mode 100644 index 9239a80d..00000000 --- a/aspnet-core/modules/FileManagement/test/Lion.AbpPro.FileManagement.HttpApi.Client.ConsoleTestApp/FileManagementConsoleApiClientModule.cs +++ /dev/null @@ -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 - { - - } -} diff --git a/aspnet-core/modules/FileManagement/test/Lion.AbpPro.FileManagement.HttpApi.Client.ConsoleTestApp/Lion.AbpPro.FileManagement.HttpApi.Client.ConsoleTestApp.abppkg.json b/aspnet-core/modules/FileManagement/test/Lion.AbpPro.FileManagement.HttpApi.Client.ConsoleTestApp/Lion.AbpPro.FileManagement.HttpApi.Client.ConsoleTestApp.abppkg.json deleted file mode 100644 index 9e26dfee..00000000 --- a/aspnet-core/modules/FileManagement/test/Lion.AbpPro.FileManagement.HttpApi.Client.ConsoleTestApp/Lion.AbpPro.FileManagement.HttpApi.Client.ConsoleTestApp.abppkg.json +++ /dev/null @@ -1 +0,0 @@ -{} \ No newline at end of file diff --git a/aspnet-core/modules/FileManagement/test/Lion.AbpPro.FileManagement.HttpApi.Client.ConsoleTestApp/Lion.AbpPro.FileManagement.HttpApi.Client.ConsoleTestApp.csproj b/aspnet-core/modules/FileManagement/test/Lion.AbpPro.FileManagement.HttpApi.Client.ConsoleTestApp/Lion.AbpPro.FileManagement.HttpApi.Client.ConsoleTestApp.csproj deleted file mode 100644 index 4a7470cc..00000000 --- a/aspnet-core/modules/FileManagement/test/Lion.AbpPro.FileManagement.HttpApi.Client.ConsoleTestApp/Lion.AbpPro.FileManagement.HttpApi.Client.ConsoleTestApp.csproj +++ /dev/null @@ -1,32 +0,0 @@ - - - - Exe - net6.0 - Lion.AbpPro.FileManagement - - - - - - - - - - - - PreserveNewest - Always - - - - PreserveNewest - Always - - - - - - - - diff --git a/aspnet-core/modules/FileManagement/test/Lion.AbpPro.FileManagement.HttpApi.Client.ConsoleTestApp/Program.cs b/aspnet-core/modules/FileManagement/test/Lion.AbpPro.FileManagement.HttpApi.Client.ConsoleTestApp/Program.cs deleted file mode 100644 index 2a2fecad..00000000 --- a/aspnet-core/modules/FileManagement/test/Lion.AbpPro.FileManagement.HttpApi.Client.ConsoleTestApp/Program.cs +++ /dev/null @@ -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(); - }); - } -} diff --git a/aspnet-core/modules/FileManagement/test/Lion.AbpPro.FileManagement.HttpApi.Client.ConsoleTestApp/appsettings.json b/aspnet-core/modules/FileManagement/test/Lion.AbpPro.FileManagement.HttpApi.Client.ConsoleTestApp/appsettings.json deleted file mode 100644 index 411c9b8e..00000000 --- a/aspnet-core/modules/FileManagement/test/Lion.AbpPro.FileManagement.HttpApi.Client.ConsoleTestApp/appsettings.json +++ /dev/null @@ -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" - } - } -} diff --git a/aspnet-core/modules/FileManagement/test/Lion.AbpPro.FileManagement.HttpApi.Client.ConsoleTestApp/appsettings.secrets.json b/aspnet-core/modules/FileManagement/test/Lion.AbpPro.FileManagement.HttpApi.Client.ConsoleTestApp/appsettings.secrets.json deleted file mode 100644 index 7a73a41b..00000000 --- a/aspnet-core/modules/FileManagement/test/Lion.AbpPro.FileManagement.HttpApi.Client.ConsoleTestApp/appsettings.secrets.json +++ /dev/null @@ -1,2 +0,0 @@ -{ -} \ No newline at end of file diff --git a/aspnet-core/modules/NotificationManagement/host/Lion.AbpPro.NotificationManagement.HttpApi.Host/Controllers/HomeController.cs b/aspnet-core/modules/NotificationManagement/host/Lion.AbpPro.NotificationManagement.HttpApi.Host/Controllers/HomeController.cs new file mode 100644 index 00000000..da0c666f --- /dev/null +++ b/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"); + } +} \ No newline at end of file diff --git a/aspnet-core/modules/NotificationManagement/host/Lion.AbpPro.NotificationManagement.HttpApi.Host/EntityFrameworkCore/FileManagementHttpApiHostMigrationsDbContext.cs b/aspnet-core/modules/NotificationManagement/host/Lion.AbpPro.NotificationManagement.HttpApi.Host/EntityFrameworkCore/FileManagementHttpApiHostMigrationsDbContext.cs new file mode 100644 index 00000000..f0ed77ac --- /dev/null +++ b/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 +{ + public NotificationManagementHttpApiHostMigrationsDbContext(DbContextOptions options) + : base(options) + { + + } + + protected override void OnModelCreating(ModelBuilder modelBuilder) + { + base.OnModelCreating(modelBuilder); + + modelBuilder.ConfigureNotificationManagement(); + } +} diff --git a/aspnet-core/modules/NotificationManagement/host/Lion.AbpPro.NotificationManagement.HttpApi.Host/EntityFrameworkCore/FileManagementHttpApiHostMigrationsDbContextFactory.cs b/aspnet-core/modules/NotificationManagement/host/Lion.AbpPro.NotificationManagement.HttpApi.Host/EntityFrameworkCore/FileManagementHttpApiHostMigrationsDbContextFactory.cs new file mode 100644 index 00000000..08237bcb --- /dev/null +++ b/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 +{ + public NotificationManagementHttpApiHostMigrationsDbContext CreateDbContext(string[] args) + { + var configuration = BuildConfiguration(); + + var builder = new DbContextOptionsBuilder() + .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(); + } +} diff --git a/aspnet-core/modules/NotificationManagement/host/Lion.AbpPro.NotificationManagement.HttpApi.Host/FodyWeavers.xml b/aspnet-core/modules/NotificationManagement/host/Lion.AbpPro.NotificationManagement.HttpApi.Host/FodyWeavers.xml new file mode 100644 index 00000000..2ad59ce1 --- /dev/null +++ b/aspnet-core/modules/NotificationManagement/host/Lion.AbpPro.NotificationManagement.HttpApi.Host/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/aspnet-core/modules/NotificationManagement/host/Lion.AbpPro.NotificationManagement.HttpApi.Host/FodyWeavers.xsd b/aspnet-core/modules/NotificationManagement/host/Lion.AbpPro.NotificationManagement.HttpApi.Host/FodyWeavers.xsd new file mode 100644 index 00000000..ffa6fc4b --- /dev/null +++ b/aspnet-core/modules/NotificationManagement/host/Lion.AbpPro.NotificationManagement.HttpApi.Host/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/aspnet-core/modules/NotificationManagement/host/Lion.AbpPro.NotificationManagement.HttpApi.Host/Lion.AbpPro.NotificationManagement.HttpApi.Host.csproj b/aspnet-core/modules/NotificationManagement/host/Lion.AbpPro.NotificationManagement.HttpApi.Host/Lion.AbpPro.NotificationManagement.HttpApi.Host.csproj new file mode 100644 index 00000000..f3ca8307 --- /dev/null +++ b/aspnet-core/modules/NotificationManagement/host/Lion.AbpPro.NotificationManagement.HttpApi.Host/Lion.AbpPro.NotificationManagement.HttpApi.Host.csproj @@ -0,0 +1,49 @@ + + + + + + net6.0 + Lion.AbpPro.NotificationManagement + true + Lion.AbpPro.NotificationManagement-c2d31439-b723-48e2-b061-5ebd7aeb6010 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/aspnet-core/modules/NotificationManagement/host/Lion.AbpPro.NotificationManagement.HttpApi.Host/Migrations/20220702015410_Init.Designer.cs b/aspnet-core/modules/NotificationManagement/host/Lion.AbpPro.NotificationManagement.HttpApi.Host/Migrations/20220702015410_Init.Designer.cs new file mode 100644 index 00000000..f40f3f56 --- /dev/null +++ b/aspnet-core/modules/NotificationManagement/host/Lion.AbpPro.NotificationManagement.HttpApi.Host/Migrations/20220702015410_Init.Designer.cs @@ -0,0 +1,162 @@ +// +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("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("Content") + .IsRequired() + .HasMaxLength(1024) + .HasColumnType("varchar(1024)"); + + b.Property("CreationTime") + .HasColumnType("datetime(6)") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("char(36)") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("char(36)") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime(6)") + .HasColumnName("DeletionTime"); + + b.Property("ExtraProperties") + .HasColumnType("longtext") + .HasColumnName("ExtraProperties"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("tinyint(1)") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("datetime(6)") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("char(36)") + .HasColumnName("LastModifierId"); + + b.Property("MessageType") + .HasColumnType("int"); + + b.Property("SenderId") + .HasColumnType("char(36)"); + + b.Property("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("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CreationTime") + .HasColumnType("datetime(6)") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("char(36)") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("char(36)") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime(6)") + .HasColumnName("DeletionTime"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("tinyint(1)") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("datetime(6)") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("char(36)") + .HasColumnName("LastModifierId"); + + b.Property("NotificationId") + .HasColumnType("char(36)"); + + b.Property("Read") + .HasColumnType("tinyint(1)"); + + b.Property("ReadTime") + .HasColumnType("datetime(6)"); + + b.Property("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 + } + } +} diff --git a/aspnet-core/modules/NotificationManagement/host/Lion.AbpPro.NotificationManagement.HttpApi.Host/Migrations/20220702015410_Init.cs b/aspnet-core/modules/NotificationManagement/host/Lion.AbpPro.NotificationManagement.HttpApi.Host/Migrations/20220702015410_Init.cs new file mode 100644 index 00000000..109241c3 --- /dev/null +++ b/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(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + Title = table.Column(type: "varchar(256)", maxLength: 256, nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + Content = table.Column(type: "varchar(1024)", maxLength: 1024, nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + MessageType = table.Column(type: "int", nullable: false), + SenderId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + ExtraProperties = table.Column(type: "longtext", nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"), + ConcurrencyStamp = table.Column(type: "varchar(40)", maxLength: 40, nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"), + CreationTime = table.Column(type: "datetime(6)", nullable: false), + CreatorId = table.Column(type: "char(36)", nullable: true, collation: "ascii_general_ci"), + LastModificationTime = table.Column(type: "datetime(6)", nullable: true), + LastModifierId = table.Column(type: "char(36)", nullable: true, collation: "ascii_general_ci"), + IsDeleted = table.Column(type: "tinyint(1)", nullable: false, defaultValue: false), + DeleterId = table.Column(type: "char(36)", nullable: true, collation: "ascii_general_ci"), + DeletionTime = table.Column(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(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + ReceiveId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + Read = table.Column(type: "tinyint(1)", nullable: false), + ReadTime = table.Column(type: "datetime(6)", nullable: true), + NotificationId = table.Column(type: "char(36)", nullable: true, collation: "ascii_general_ci"), + CreationTime = table.Column(type: "datetime(6)", nullable: false), + CreatorId = table.Column(type: "char(36)", nullable: true, collation: "ascii_general_ci"), + LastModificationTime = table.Column(type: "datetime(6)", nullable: true), + LastModifierId = table.Column(type: "char(36)", nullable: true, collation: "ascii_general_ci"), + IsDeleted = table.Column(type: "tinyint(1)", nullable: false, defaultValue: false), + DeleterId = table.Column(type: "char(36)", nullable: true, collation: "ascii_general_ci"), + DeletionTime = table.Column(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"); + } + } +} diff --git a/aspnet-core/modules/NotificationManagement/host/Lion.AbpPro.NotificationManagement.HttpApi.Host/Migrations/NotificationManagementHttpApiHostMigrationsDbContextModelSnapshot.cs b/aspnet-core/modules/NotificationManagement/host/Lion.AbpPro.NotificationManagement.HttpApi.Host/Migrations/NotificationManagementHttpApiHostMigrationsDbContextModelSnapshot.cs new file mode 100644 index 00000000..0241fca1 --- /dev/null +++ b/aspnet-core/modules/NotificationManagement/host/Lion.AbpPro.NotificationManagement.HttpApi.Host/Migrations/NotificationManagementHttpApiHostMigrationsDbContextModelSnapshot.cs @@ -0,0 +1,160 @@ +// +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("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("Content") + .IsRequired() + .HasMaxLength(1024) + .HasColumnType("varchar(1024)"); + + b.Property("CreationTime") + .HasColumnType("datetime(6)") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("char(36)") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("char(36)") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime(6)") + .HasColumnName("DeletionTime"); + + b.Property("ExtraProperties") + .HasColumnType("longtext") + .HasColumnName("ExtraProperties"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("tinyint(1)") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("datetime(6)") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("char(36)") + .HasColumnName("LastModifierId"); + + b.Property("MessageType") + .HasColumnType("int"); + + b.Property("SenderId") + .HasColumnType("char(36)"); + + b.Property("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("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CreationTime") + .HasColumnType("datetime(6)") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("char(36)") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("char(36)") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime(6)") + .HasColumnName("DeletionTime"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("tinyint(1)") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("datetime(6)") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("char(36)") + .HasColumnName("LastModifierId"); + + b.Property("NotificationId") + .HasColumnType("char(36)"); + + b.Property("Read") + .HasColumnType("tinyint(1)"); + + b.Property("ReadTime") + .HasColumnType("datetime(6)"); + + b.Property("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 + } + } +} diff --git a/aspnet-core/modules/NotificationManagement/host/Lion.AbpPro.NotificationManagement.HttpApi.Host/NotificationManagementHttpApiHostModule.cs b/aspnet-core/modules/NotificationManagement/host/Lion.AbpPro.NotificationManagement.HttpApi.Host/NotificationManagementHttpApiHostModule.cs new file mode 100644 index 00000000..ada7a3fb --- /dev/null +++ b/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(); + } + + /// + /// 配置虚拟文件系统 + /// + private void ConfigureVirtualFileSystem() + { + Configure(options => { options.FileSets.AddEmbedded(); }); + } + + private void ConfigDB() + { + Configure(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(); + capOptions.UseRabbitMQ(option => + { + option.HostName = configuration.GetValue("Cap:RabbitMq:HostName"); + option.UserName = configuration.GetValue("Cap:RabbitMq:UserName"); + option.Password = configuration.GetValue("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; }); + }); + } + } + + /// + /// 配置SwaggerUI + /// + /// + 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(options => { options.AutoValidate = false; }); + } + + /// + /// 配置本地化 + /// + private void ConfigureLocalization() + { + Configure(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")); + }); + } + + /// + /// Redis缓存 + /// + /// + private void ConfigureCache(ServiceConfigurationContext context) + { + Configure(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"); + } + + /// + /// 配置跨域 + /// + 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(); + }); + }); + } +} \ No newline at end of file diff --git a/aspnet-core/modules/NotificationManagement/host/Lion.AbpPro.NotificationManagement.HttpApi.Host/Program.cs b/aspnet-core/modules/NotificationManagement/host/Lion.AbpPro.NotificationManagement.HttpApi.Host/Program.cs new file mode 100644 index 00000000..3fdd2328 --- /dev/null +++ b/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(); + }) + .UseSerilog().UseAutofac(); + } +} \ No newline at end of file diff --git a/aspnet-core/modules/NotificationManagement/host/Lion.AbpPro.NotificationManagement.HttpApi.Host/Properties/launchSettings.json b/aspnet-core/modules/NotificationManagement/host/Lion.AbpPro.NotificationManagement.HttpApi.Host/Properties/launchSettings.json new file mode 100644 index 00000000..03f86edb --- /dev/null +++ b/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" + } + } + } +} \ No newline at end of file diff --git a/aspnet-core/modules/NotificationManagement/host/Lion.AbpPro.NotificationManagement.HttpApi.Host/Startup.cs b/aspnet-core/modules/NotificationManagement/host/Lion.AbpPro.NotificationManagement.HttpApi.Host/Startup.cs new file mode 100644 index 00000000..58687f8a --- /dev/null +++ b/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(); + } + + public void Configure(IApplicationBuilder app, IWebHostEnvironment env, ILoggerFactory loggerFactory) + { + app.InitializeApplication(); + } +} \ No newline at end of file diff --git a/aspnet-core/modules/NotificationManagement/host/Lion.AbpPro.NotificationManagement.HttpApi.Host/appsettings.json b/aspnet-core/modules/NotificationManagement/host/Lion.AbpPro.NotificationManagement.HttpApi.Host/appsettings.json new file mode 100644 index 00000000..b97f4aa8 --- /dev/null +++ b/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*" + } + } +} \ No newline at end of file diff --git a/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Domain/Notifications/Aggregates/Notification.cs b/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Domain/Notifications/Aggregates/Notification.cs index e6cd78bb..c2a6f1af 100644 --- a/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Domain/Notifications/Aggregates/Notification.cs +++ b/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Domain/Notifications/Aggregates/Notification.cs @@ -13,7 +13,7 @@ namespace Lion.AbpPro.NotificationManagement.Notifications.Aggregates /// /// 消息通知 /// - public partial class Notification : FullAuditedAggregateRoot + public class Notification : FullAuditedAggregateRoot { /// /// 消息标题 diff --git a/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Domain/Notifications/NotificationManager.cs b/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Domain/Notifications/NotificationManager.cs index 22a10b79..d32b8810 100644 --- a/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Domain/Notifications/NotificationManager.cs +++ b/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(entity); // 发送集成事件 entity.AddCreatedNotificationDistributedEvent(new CreatedNotificationDistributedEvent(notificationEto)); - return entity = await _notificationRepository.InsertAsync(entity); + return await _notificationRepository.InsertAsync(entity); } /// diff --git a/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/AbpProHttpApiHostModule.cs b/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/AbpProHttpApiHostModule.cs index 1586aeb0..081ca701 100644 --- a/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/AbpProHttpApiHostModule.cs +++ b/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(options => { options.Lockout = new LockoutOptions() { AllowedForNewUsers = false }; }); } - // private void ConfigureConventionalControllers() - // { - // Configure(options => - // { - // options.ConventionalControllers.Create(typeof(AbpProApplicationModule).Assembly); - // }); - // } - private static void ConfigureSwaggerServices(ServiceConfigurationContext context) { context.Services.AddSwaggerGen( @@ -426,5 +375,29 @@ namespace Lion.AbpPro }); } } + + /// + /// 审计日志 + /// + private void ConfigureAuditLog(ServiceConfigurationContext context) + { + Configure + ( + options => + { + options.IsEnabled = true; + options.EntityHistorySelectors.AddAllEntities(); + options.ApplicationName = "Lion.AbpPro"; + } + ); + + Configure( + options => + { + options.IgnoredUrls.Add("/AuditLogs/page"); + options.IgnoredUrls.Add("/hangfire/stats"); + options.IgnoredUrls.Add("/cap"); + }); + } } } \ No newline at end of file diff --git a/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/Controllers/HomeController.cs b/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/Controllers/HomeController.cs index ef9d9bcc..16fd476a 100644 --- a/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/Controllers/HomeController.cs +++ b/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 diff --git a/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/Extensions/Hangfire/AutoDeleteAfterSuccessAttributer.cs b/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/Extensions/Hangfire/AutoDeleteAfterSuccessAttributer.cs index e961e364..0f94e551 100644 --- a/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/Extensions/Hangfire/AutoDeleteAfterSuccessAttributer.cs +++ b/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 { diff --git a/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/Extensions/Hangfire/CronType.cs b/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/Extensions/Hangfire/CronType.cs index a19ca4e6..cf38091e 100644 --- a/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/Extensions/Hangfire/CronType.cs +++ b/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 { /// diff --git a/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/Extensions/Hangfire/CustomHangfireAuthorizeFilter.cs b/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/Extensions/Hangfire/CustomHangfireAuthorizeFilter.cs index 801f7fcb..08e95248 100644 --- a/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/Extensions/Hangfire/CustomHangfireAuthorizeFilter.cs +++ b/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 diff --git a/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/Extensions/Hangfire/JobRetryLastFilter.cs b/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/Extensions/Hangfire/JobRetryLastFilter.cs index f46c1a8d..02b88042 100644 --- a/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/Extensions/Hangfire/JobRetryLastFilter.cs +++ b/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; /// /// 重试最后一次 diff --git a/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/Extensions/MVC/Filters/ResultExceptionFilter.cs b/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/Extensions/MVC/Filters/ResultExceptionFilter.cs index f076ac63..87f1b3e7 100644 --- a/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/Extensions/MVC/Filters/ResultExceptionFilter.cs +++ b/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 diff --git a/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/Extensions/Middlewares/AbpProApplicationBuilderExtensionsExtensions.cs b/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/Extensions/Middlewares/AbpProApplicationBuilderExtensionsExtensions.cs index 370a65bb..e840b238 100644 --- a/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/Extensions/Middlewares/AbpProApplicationBuilderExtensionsExtensions.cs +++ b/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 { diff --git a/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/Extensions/Middlewares/RequestLogMiddleware.cs b/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/Extensions/Middlewares/RequestLogMiddleware.cs index 780f43ad..fe7d4861 100644 --- a/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/Extensions/Middlewares/RequestLogMiddleware.cs +++ b/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 { diff --git a/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/Extensions/RecurringJobsExtensions.cs b/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/Extensions/RecurringJobsExtensions.cs index 2872a18d..8b9f4c65 100644 --- a/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/Extensions/RecurringJobsExtensions.cs +++ b/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 { diff --git a/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/Extensions/SerilogToEsExtensions.cs b/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/Extensions/SerilogToEsExtensions.cs index 841e3f95..80d7fa41 100644 --- a/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/Extensions/SerilogToEsExtensions.cs +++ b/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 { diff --git a/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/Extensions/System/WrapResultAttribute.cs b/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/Extensions/System/WrapResultAttribute.cs index f9c2e50f..aa3a4ad5 100644 --- a/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/Extensions/System/WrapResultAttribute.cs +++ b/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 { diff --git a/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/GlobalUsings.cs b/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/GlobalUsings.cs new file mode 100644 index 00000000..29a516c9 --- /dev/null +++ b/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; \ No newline at end of file diff --git a/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/Pages/Login.cshtml.cs b/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/Pages/Login.cshtml.cs index 5e855727..6d5744ee 100644 --- a/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/Pages/Login.cshtml.cs +++ b/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 diff --git a/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/Program.cs b/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/Program.cs index 053d760b..aa1c734f 100644 --- a/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/Program.cs +++ b/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 diff --git a/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/Startup.cs b/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/Startup.cs index 9cf8580c..96eabd17 100644 --- a/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/Startup.cs +++ b/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 diff --git a/aspnet-core/services/src/Lion.AbpPro.Application/Roles/RolePermissionAppService.cs b/aspnet-core/services/src/Lion.AbpPro.Application/Roles/RolePermissionAppService.cs index 4fd606bd..50e1b0e5 100644 --- a/aspnet-core/services/src/Lion.AbpPro.Application/Roles/RolePermissionAppService.cs +++ b/aspnet-core/services/src/Lion.AbpPro.Application/Roles/RolePermissionAppService.cs @@ -65,11 +65,10 @@ namespace Lion.AbpPro.Roles }; var permissions = new List(); - 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); } diff --git a/aspnet-core/services/src/Lion.AbpPro.Application/Users/UserAppService.cs b/aspnet-core/services/src/Lion.AbpPro.Application/Users/UserAppService.cs index ad25e9b1..5d8dbdc9 100644 --- a/aspnet-core/services/src/Lion.AbpPro.Application/Users/UserAppService.cs +++ b/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 _options; - private readonly IBulkImportUserRepository _bulkImportUserRepository; public UserAppService( IIdentityUserAppService identityUserAppService, IdentityUserManager userManager, IIdentityUserRepository userRepository, IExcelExporter excelExporter, - IOptions options, - NotificationManager notificationManager, - IBulkImportUserRepository bulkImportUserRepository) + IOptions options) { _identityUserAppService = identityUserAppService; _userManager = userManager; _identityUserRepository = userRepository; _excelExporter = excelExporter; _options = options; - _bulkImportUserRepository = bulkImportUserRepository; } /// @@ -64,8 +57,8 @@ namespace Lion.AbpPro.Users Sorting = " LastModificationTime desc" }; - long count = await _identityUserRepository.GetCountAsync(request.Filter); - List 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(count, @@ -86,7 +79,7 @@ namespace Lion.AbpPro.Users SkipCount = input.SkipCount, Sorting = " LastModificationTime desc" }; - List source = await _identityUserRepository + var source = await _identityUserRepository .GetListAsync(request.Sorting, request.MaxResultCount, request.SkipCount, request.Filter); var result = ObjectMapper.Map, List>(source); var bytes = await _excelExporter.ExportAsByteArray(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(){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, ITransientDependency -{ - public async Task HandleEventAsync(TestEvent eventData) - { - var s = "1"; - } -} \ No newline at end of file diff --git a/aspnet-core/services/src/Lion.AbpPro.EntityFrameworkCore/EntityFrameworkCore/Users/BulkImportUserRepository.cs b/aspnet-core/services/src/Lion.AbpPro.EntityFrameworkCore/EntityFrameworkCore/Users/BulkImportUserRepository.cs index 0e9cddc3..aa909852 100644 --- a/aspnet-core/services/src/Lion.AbpPro.EntityFrameworkCore/EntityFrameworkCore/Users/BulkImportUserRepository.cs +++ b/aspnet-core/services/src/Lion.AbpPro.EntityFrameworkCore/EntityFrameworkCore/Users/BulkImportUserRepository.cs @@ -21,8 +21,6 @@ public class BulkImportUserRepository:IBulkImportUserRepository public async Task BulkInsertAsync(List identityUsers) { // TODO 这个地方创建人和创建时间需要手动赋值。 - - // 完美契合abp,并且能够触发领域事件和分布式事件 var context = await _contextProvider.GetDbContextAsync(); await context.BulkInsertAsync(identityUsers, context.Database.CurrentTransaction.GetDbTransaction() as MySqlTransaction); } diff --git a/vben271/src/views/sys/login/useLogin.ts b/vben271/src/views/sys/login/useLogin.ts index 3c198fef..8c1e20fe 100644 --- a/vben271/src/views/sys/login/useLogin.ts +++ b/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(); }