From 73f507f60556407b6c78eb61d2208d9550b8d94b Mon Sep 17 00:00:00 2001 From: Necati Meral Date: Wed, 19 Feb 2020 10:58:36 +0100 Subject: [PATCH 01/56] Updated `HttpAPi.Client` projects to target `netstandard2.0` This makes the usage of clients in traditional .netfx applications (WinForms) possible --- .../src/Volo.Abp.Http.Client/Volo.Abp.Http.Client.csproj | 6 ++---- .../Volo.Abp.Account.HttpApi.Client.csproj | 2 +- .../Volo.Blogging.HttpApi.Client.csproj | 2 +- .../Volo.Docs.HttpApi.Client.csproj | 2 +- .../Volo.Abp.FeatureManagement.HttpApi.Client.csproj | 2 +- .../Volo.Abp.Identity.HttpApi.Client.csproj | 6 ++---- .../Volo.Abp.PermissionManagement.HttpApi.Client.csproj | 2 +- .../Volo.Abp.TenantManagement.HttpApi.Client.csproj | 2 +- 8 files changed, 10 insertions(+), 14 deletions(-) diff --git a/framework/src/Volo.Abp.Http.Client/Volo.Abp.Http.Client.csproj b/framework/src/Volo.Abp.Http.Client/Volo.Abp.Http.Client.csproj index 461a0c35f5..99f480ee63 100644 --- a/framework/src/Volo.Abp.Http.Client/Volo.Abp.Http.Client.csproj +++ b/framework/src/Volo.Abp.Http.Client/Volo.Abp.Http.Client.csproj @@ -1,18 +1,16 @@ - + - netcoreapp3.1 + netstandard2.0 Volo.Abp.Http.Client Volo.Abp.Http.Client $(AssetTargetFallback);portable-net45+win8+wp8+wpa81; false false false - true - Library diff --git a/modules/account/src/Volo.Abp.Account.HttpApi.Client/Volo.Abp.Account.HttpApi.Client.csproj b/modules/account/src/Volo.Abp.Account.HttpApi.Client/Volo.Abp.Account.HttpApi.Client.csproj index 89679b3e22..aef884dbe2 100644 --- a/modules/account/src/Volo.Abp.Account.HttpApi.Client/Volo.Abp.Account.HttpApi.Client.csproj +++ b/modules/account/src/Volo.Abp.Account.HttpApi.Client/Volo.Abp.Account.HttpApi.Client.csproj @@ -4,7 +4,7 @@ - netcoreapp3.1 + netstandard2.0 Volo.Abp.Account.HttpApi.Client Volo.Abp.Account.HttpApi.Client diff --git a/modules/blogging/src/Volo.Blogging.HttpApi.Client/Volo.Blogging.HttpApi.Client.csproj b/modules/blogging/src/Volo.Blogging.HttpApi.Client/Volo.Blogging.HttpApi.Client.csproj index 754382f89c..68b3775baa 100644 --- a/modules/blogging/src/Volo.Blogging.HttpApi.Client/Volo.Blogging.HttpApi.Client.csproj +++ b/modules/blogging/src/Volo.Blogging.HttpApi.Client/Volo.Blogging.HttpApi.Client.csproj @@ -4,7 +4,7 @@ - netcoreapp3.1 + netstandard2.0 Volo.Blogging.HttpApi.Client Volo.Blogging.HttpApi.Client diff --git a/modules/docs/src/Volo.Docs.HttpApi.Client/Volo.Docs.HttpApi.Client.csproj b/modules/docs/src/Volo.Docs.HttpApi.Client/Volo.Docs.HttpApi.Client.csproj index f527001c45..5df5515e32 100644 --- a/modules/docs/src/Volo.Docs.HttpApi.Client/Volo.Docs.HttpApi.Client.csproj +++ b/modules/docs/src/Volo.Docs.HttpApi.Client/Volo.Docs.HttpApi.Client.csproj @@ -4,7 +4,7 @@ - netcoreapp3.1 + netstandard2.0 Volo.Docs.HttpApi.Client Volo.Docs.HttpApi.Client diff --git a/modules/feature-management/src/Volo.Abp.FeatureManagement.HttpApi.Client/Volo.Abp.FeatureManagement.HttpApi.Client.csproj b/modules/feature-management/src/Volo.Abp.FeatureManagement.HttpApi.Client/Volo.Abp.FeatureManagement.HttpApi.Client.csproj index 1a784f6e6c..a6dd5772e8 100644 --- a/modules/feature-management/src/Volo.Abp.FeatureManagement.HttpApi.Client/Volo.Abp.FeatureManagement.HttpApi.Client.csproj +++ b/modules/feature-management/src/Volo.Abp.FeatureManagement.HttpApi.Client/Volo.Abp.FeatureManagement.HttpApi.Client.csproj @@ -4,7 +4,7 @@ - netcoreapp3.1 + netstandard2.0 diff --git a/modules/identity/src/Volo.Abp.Identity.HttpApi.Client/Volo.Abp.Identity.HttpApi.Client.csproj b/modules/identity/src/Volo.Abp.Identity.HttpApi.Client/Volo.Abp.Identity.HttpApi.Client.csproj index 11fd0a40b6..5bff2432a7 100644 --- a/modules/identity/src/Volo.Abp.Identity.HttpApi.Client/Volo.Abp.Identity.HttpApi.Client.csproj +++ b/modules/identity/src/Volo.Abp.Identity.HttpApi.Client/Volo.Abp.Identity.HttpApi.Client.csproj @@ -1,18 +1,16 @@ - + - netcoreapp3.1 + netstandard2.0 Volo.Abp.Identity.HttpApi.Client Volo.Abp.Identity.HttpApi.Client $(AssetTargetFallback);portable-net45+win8+wp8+wpa81; false false false - Library - true diff --git a/modules/permission-management/src/Volo.Abp.PermissionManagement.HttpApi.Client/Volo.Abp.PermissionManagement.HttpApi.Client.csproj b/modules/permission-management/src/Volo.Abp.PermissionManagement.HttpApi.Client/Volo.Abp.PermissionManagement.HttpApi.Client.csproj index 8360442b75..a198deb9eb 100644 --- a/modules/permission-management/src/Volo.Abp.PermissionManagement.HttpApi.Client/Volo.Abp.PermissionManagement.HttpApi.Client.csproj +++ b/modules/permission-management/src/Volo.Abp.PermissionManagement.HttpApi.Client/Volo.Abp.PermissionManagement.HttpApi.Client.csproj @@ -4,7 +4,7 @@ - netcoreapp3.1 + netstandard2.0 Volo.Abp.PermissionManagement.HttpApi.Client Volo.Abp.PermissionManagement.HttpApi.Client $(AssetTargetFallback);portable-net45+win8+wp8+wpa81; diff --git a/modules/tenant-management/src/Volo.Abp.TenantManagement.HttpApi.Client/Volo.Abp.TenantManagement.HttpApi.Client.csproj b/modules/tenant-management/src/Volo.Abp.TenantManagement.HttpApi.Client/Volo.Abp.TenantManagement.HttpApi.Client.csproj index 9c36b1b29e..263d7b4048 100644 --- a/modules/tenant-management/src/Volo.Abp.TenantManagement.HttpApi.Client/Volo.Abp.TenantManagement.HttpApi.Client.csproj +++ b/modules/tenant-management/src/Volo.Abp.TenantManagement.HttpApi.Client/Volo.Abp.TenantManagement.HttpApi.Client.csproj @@ -4,7 +4,7 @@ - netcoreapp3.1 + netstandard2.0 Volo.Abp.TenantManagement.HttpApi.Client Volo.Abp.TenantManagement.HttpApi.Client $(AssetTargetFallback);portable-net45+win8+wp8+wpa81; From 9c5c4a04c609be5bc3f222de640a71ed570a98a4 Mon Sep 17 00:00:00 2001 From: Yunus Emre Kalkan Date: Thu, 20 Feb 2020 13:41:06 +0300 Subject: [PATCH 02/56] Update CLI.md --- docs/en/CLI.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/docs/en/CLI.md b/docs/en/CLI.md index a1d3d51138..531922baec 100644 --- a/docs/en/CLI.md +++ b/docs/en/CLI.md @@ -128,6 +128,24 @@ abp update [options] * `--npm`: Only updates NPM packages. * `--nuget`: Only updates NuGet packages. +### Switch to nightly build (preview) packages + +To switch your project to latest preview version of ABP framework, you can use this command. + +Usage: + +````bash +abp switch-to-preview [options] +```` +You can also switch back to stable version using: + +````bash +abp switch-to-stable [options] +```` +#### Options + +`--solution-path` or `-sp`: Specifies the solution (.sln) file path. If not specified, CLI tries to find a .sln file in the current directory. + ### login Some features of the CLI requires to be logged in to abp.io platform. To login with your username write From 866a5b8b96857322cf40e4ba582ed57625e583fa Mon Sep 17 00:00:00 2001 From: Necati Meral Date: Fri, 21 Feb 2020 10:32:13 +0100 Subject: [PATCH 03/56] Created new framework package `Volo.Abp.Http.Client.IdentityModel.Relay` Package contains the 'pass-through' authenticator-implementation which previously was in `Volo.Abp.Http.Client.IdentityModel.IdentityModelRemoteServiceHttpClientAuthenticator`. Since the `IdentityModelRemoteServiceHttpClientAuthenticator` implementation (without requiring `IHttpContextAccessor`) is required for basic clients (which should be able to target net-standard or netfx) this package was splitted into `Volo.Abp.Http.Client.IdentityModel.Relay` to support the known behavior of just passing the token around. WARNING: This commit contains a breaking change for existing backend applications which use automagic C# clients! --- framework/Volo.Abp.sln | 18 +++++-- .../FodyWeavers.xml | 3 ++ .../FodyWeavers.xsd | 30 ++++++++++++ .../Properties/launchSettings.json | 27 +++++++++++ ...Abp.Http.Client.IdentityModel.Relay.csproj | 23 +++++++++ .../Relay/AbpHttpClientIdentityModelModule.cs | 13 +++++ ...moteServiceHttpClientRelayAuthenticator.cs | 48 +++++++++++++++++++ .../Volo.Abp.Http.Client.IdentityModel.csproj | 6 +-- ...delRemoteServiceHttpClientAuthenticator.cs | 27 +---------- 9 files changed, 160 insertions(+), 35 deletions(-) create mode 100644 framework/src/Volo.Abp.Http.Client.IdentityModel.Relay/FodyWeavers.xml create mode 100644 framework/src/Volo.Abp.Http.Client.IdentityModel.Relay/FodyWeavers.xsd create mode 100644 framework/src/Volo.Abp.Http.Client.IdentityModel.Relay/Properties/launchSettings.json create mode 100644 framework/src/Volo.Abp.Http.Client.IdentityModel.Relay/Volo.Abp.Http.Client.IdentityModel.Relay.csproj create mode 100644 framework/src/Volo.Abp.Http.Client.IdentityModel.Relay/Volo/Abp/Http/Client/IdentityModel/Relay/AbpHttpClientIdentityModelModule.cs create mode 100644 framework/src/Volo.Abp.Http.Client.IdentityModel.Relay/Volo/Abp/Http/Client/IdentityModel/Relay/IdentityModelRemoteServiceHttpClientRelayAuthenticator.cs diff --git a/framework/Volo.Abp.sln b/framework/Volo.Abp.sln index b731aff187..ee45583895 100644 --- a/framework/Volo.Abp.sln +++ b/framework/Volo.Abp.sln @@ -1,4 +1,5 @@ -Microsoft Visual Studio Solution File, Format Version 12.00 + +Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 16 VisualStudioVersion = 16.0.28922.388 MinimumVisualStudioVersion = 10.0.40219.1 @@ -252,13 +253,15 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Volo.Abp.ObjectMapping.Test EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Volo.Abp.Ddd.Application.Contracts", "src\Volo.Abp.Ddd.Application.Contracts\Volo.Abp.Ddd.Application.Contracts.csproj", "{73559227-EBF0-475F-835B-1FF0CD9132AA}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Volo.Abp.Minify", "src\Volo.Abp.Minify\Volo.Abp.Minify.csproj", "{928DC30D-C078-4BB4-A9F8-FE7252C67DC6}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Volo.Abp.Minify", "src\Volo.Abp.Minify\Volo.Abp.Minify.csproj", "{928DC30D-C078-4BB4-A9F8-FE7252C67DC6}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Volo.Abp.Minify.Tests", "test\Volo.Abp.Minify.Tests\Volo.Abp.Minify.Tests.csproj", "{E69182B3-350A-43F5-A935-5EBBEBECEF97}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Volo.Abp.Minify.Tests", "test\Volo.Abp.Minify.Tests\Volo.Abp.Minify.Tests.csproj", "{E69182B3-350A-43F5-A935-5EBBEBECEF97}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Volo.Abp.AspNetCore.Serilog", "src\Volo.Abp.AspNetCore.Serilog\Volo.Abp.AspNetCore.Serilog.csproj", "{3B801003-BE74-49ED-9749-DA5E99F45EBF}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Volo.Abp.AspNetCore.Serilog", "src\Volo.Abp.AspNetCore.Serilog\Volo.Abp.AspNetCore.Serilog.csproj", "{3B801003-BE74-49ED-9749-DA5E99F45EBF}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Volo.Abp.AspNetCore.Serilog.Tests", "test\Volo.Abp.AspNetCore.Serilog.Tests\Volo.Abp.AspNetCore.Serilog.Tests.csproj", "{9CAA07ED-FE5C-4427-A6FA-6C6CB5B4CC62}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Volo.Abp.AspNetCore.Serilog.Tests", "test\Volo.Abp.AspNetCore.Serilog.Tests\Volo.Abp.AspNetCore.Serilog.Tests.csproj", "{9CAA07ED-FE5C-4427-A6FA-6C6CB5B4CC62}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Volo.Abp.Http.Client.IdentityModel.Relay", "src\Volo.Abp.Http.Client.IdentityModel.Relay\Volo.Abp.Http.Client.IdentityModel.Relay.csproj", "{925AF101-2203-409C-9C3B-03917316858F}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -774,6 +777,10 @@ Global {9CAA07ED-FE5C-4427-A6FA-6C6CB5B4CC62}.Debug|Any CPU.Build.0 = Debug|Any CPU {9CAA07ED-FE5C-4427-A6FA-6C6CB5B4CC62}.Release|Any CPU.ActiveCfg = Release|Any CPU {9CAA07ED-FE5C-4427-A6FA-6C6CB5B4CC62}.Release|Any CPU.Build.0 = Release|Any CPU + {925AF101-2203-409C-9C3B-03917316858F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {925AF101-2203-409C-9C3B-03917316858F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {925AF101-2203-409C-9C3B-03917316858F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {925AF101-2203-409C-9C3B-03917316858F}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -906,6 +913,7 @@ Global {E69182B3-350A-43F5-A935-5EBBEBECEF97} = {447C8A77-E5F0-4538-8687-7383196D04EA} {3B801003-BE74-49ED-9749-DA5E99F45EBF} = {5DF0E140-0513-4D0D-BE2E-3D4D85CD70E6} {9CAA07ED-FE5C-4427-A6FA-6C6CB5B4CC62} = {447C8A77-E5F0-4538-8687-7383196D04EA} + {925AF101-2203-409C-9C3B-03917316858F} = {5DF0E140-0513-4D0D-BE2E-3D4D85CD70E6} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {BB97ECF4-9A84-433F-A80B-2A3285BDD1D5} diff --git a/framework/src/Volo.Abp.Http.Client.IdentityModel.Relay/FodyWeavers.xml b/framework/src/Volo.Abp.Http.Client.IdentityModel.Relay/FodyWeavers.xml new file mode 100644 index 0000000000..be0de3a908 --- /dev/null +++ b/framework/src/Volo.Abp.Http.Client.IdentityModel.Relay/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/framework/src/Volo.Abp.Http.Client.IdentityModel.Relay/FodyWeavers.xsd b/framework/src/Volo.Abp.Http.Client.IdentityModel.Relay/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/framework/src/Volo.Abp.Http.Client.IdentityModel.Relay/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/framework/src/Volo.Abp.Http.Client.IdentityModel.Relay/Properties/launchSettings.json b/framework/src/Volo.Abp.Http.Client.IdentityModel.Relay/Properties/launchSettings.json new file mode 100644 index 0000000000..d56e5c65b7 --- /dev/null +++ b/framework/src/Volo.Abp.Http.Client.IdentityModel.Relay/Properties/launchSettings.json @@ -0,0 +1,27 @@ +{ + "iisSettings": { + "windowsAuthentication": false, + "anonymousAuthentication": true, + "iisExpress": { + "applicationUrl": "http://localhost:52306/", + "sslPort": 0 + } + }, + "profiles": { + "IIS Express": { + "commandName": "IISExpress", + "launchBrowser": true, + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "Volo.Abp.Http.Client.IdentityModel": { + "commandName": "Project", + "launchBrowser": true, + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + }, + "applicationUrl": "http://localhost:52307/" + } + } +} \ No newline at end of file diff --git a/framework/src/Volo.Abp.Http.Client.IdentityModel.Relay/Volo.Abp.Http.Client.IdentityModel.Relay.csproj b/framework/src/Volo.Abp.Http.Client.IdentityModel.Relay/Volo.Abp.Http.Client.IdentityModel.Relay.csproj new file mode 100644 index 0000000000..8974420c46 --- /dev/null +++ b/framework/src/Volo.Abp.Http.Client.IdentityModel.Relay/Volo.Abp.Http.Client.IdentityModel.Relay.csproj @@ -0,0 +1,23 @@ + + + + + + + netcoreapp3.1 + Volo.Abp.Http.Client.IdentityModel.Relay + Volo.Abp.Http.Client.IdentityModel.Relay + $(AssetTargetFallback);portable-net45+win8+wp8+wpa81; + false + false + false + true + Library + + + + + + + + diff --git a/framework/src/Volo.Abp.Http.Client.IdentityModel.Relay/Volo/Abp/Http/Client/IdentityModel/Relay/AbpHttpClientIdentityModelModule.cs b/framework/src/Volo.Abp.Http.Client.IdentityModel.Relay/Volo/Abp/Http/Client/IdentityModel/Relay/AbpHttpClientIdentityModelModule.cs new file mode 100644 index 0000000000..086d3de06d --- /dev/null +++ b/framework/src/Volo.Abp.Http.Client.IdentityModel.Relay/Volo/Abp/Http/Client/IdentityModel/Relay/AbpHttpClientIdentityModelModule.cs @@ -0,0 +1,13 @@ +using Volo.Abp.IdentityModel; +using Volo.Abp.Modularity; + +namespace Volo.Abp.Http.Client.IdentityModel.Relay +{ + [DependsOn( + typeof(AbpHttpClientIdentityModelModule) + )] + public class AbpHttpClientIdentityModelRelayModule : AbpModule + { + + } +} diff --git a/framework/src/Volo.Abp.Http.Client.IdentityModel.Relay/Volo/Abp/Http/Client/IdentityModel/Relay/IdentityModelRemoteServiceHttpClientRelayAuthenticator.cs b/framework/src/Volo.Abp.Http.Client.IdentityModel.Relay/Volo/Abp/Http/Client/IdentityModel/Relay/IdentityModelRemoteServiceHttpClientRelayAuthenticator.cs new file mode 100644 index 0000000000..25a1fc771c --- /dev/null +++ b/framework/src/Volo.Abp.Http.Client.IdentityModel.Relay/Volo/Abp/Http/Client/IdentityModel/Relay/IdentityModelRemoteServiceHttpClientRelayAuthenticator.cs @@ -0,0 +1,48 @@ +using System.Threading.Tasks; +using IdentityModel.Client; +using Microsoft.AspNetCore.Authentication; +using Microsoft.AspNetCore.Http; +using Volo.Abp.DependencyInjection; +using Volo.Abp.Http.Client.Authentication; +using Volo.Abp.IdentityModel; + +namespace Volo.Abp.Http.Client.IdentityModel.Relay +{ + [Dependency(ReplaceServices = true)] + public class IdentityModelRemoteServiceHttpClientRelayAuthenticator : IdentityModelRemoteServiceHttpClientAuthenticator, ITransientDependency + { + public IHttpContextAccessor HttpContextAccessor { get; set; } + + public IdentityModelRemoteServiceHttpClientRelayAuthenticator( + IIdentityModelAuthenticationService identityModelAuthenticationService) + : base(identityModelAuthenticationService) + { + } + + public override async Task Authenticate(RemoteServiceHttpClientAuthenticateContext context) + { + if (context.RemoteService.GetUseCurrentAccessToken() != false) + { + var accessToken = await GetAccessTokenFromHttpContextOrNullAsync(); + if (accessToken != null) + { + context.Request.SetBearerToken(accessToken); + return; + } + } + + await base.Authenticate(context); + } + + protected virtual async Task GetAccessTokenFromHttpContextOrNullAsync() + { + var httpContext = HttpContextAccessor?.HttpContext; + if (httpContext == null) + { + return null; + } + + return await httpContext.GetTokenAsync("access_token"); + } + } +} diff --git a/framework/src/Volo.Abp.Http.Client.IdentityModel/Volo.Abp.Http.Client.IdentityModel.csproj b/framework/src/Volo.Abp.Http.Client.IdentityModel/Volo.Abp.Http.Client.IdentityModel.csproj index e62293964a..d8eef1ba5d 100644 --- a/framework/src/Volo.Abp.Http.Client.IdentityModel/Volo.Abp.Http.Client.IdentityModel.csproj +++ b/framework/src/Volo.Abp.Http.Client.IdentityModel/Volo.Abp.Http.Client.IdentityModel.csproj @@ -1,18 +1,16 @@ - + - netcoreapp3.1 + netstandard2.0 Volo.Abp.Http.Client.IdentityModel Volo.Abp.Http.Client.IdentityModel $(AssetTargetFallback);portable-net45+win8+wp8+wpa81; false false false - true - Library diff --git a/framework/src/Volo.Abp.Http.Client.IdentityModel/Volo/Abp/Http/Client/IdentityModel/IdentityModelRemoteServiceHttpClientAuthenticator.cs b/framework/src/Volo.Abp.Http.Client.IdentityModel/Volo/Abp/Http/Client/IdentityModel/IdentityModelRemoteServiceHttpClientAuthenticator.cs index 25763efbd5..5d9a85e0c5 100644 --- a/framework/src/Volo.Abp.Http.Client.IdentityModel/Volo/Abp/Http/Client/IdentityModel/IdentityModelRemoteServiceHttpClientAuthenticator.cs +++ b/framework/src/Volo.Abp.Http.Client.IdentityModel/Volo/Abp/Http/Client/IdentityModel/IdentityModelRemoteServiceHttpClientAuthenticator.cs @@ -1,7 +1,5 @@ using System.Threading.Tasks; using IdentityModel.Client; -using Microsoft.AspNetCore.Authentication; -using Microsoft.AspNetCore.Http; using Volo.Abp.DependencyInjection; using Volo.Abp.Http.Client.Authentication; using Volo.Abp.IdentityModel; @@ -11,8 +9,6 @@ namespace Volo.Abp.Http.Client.IdentityModel [Dependency(ReplaceServices = true)] public class IdentityModelRemoteServiceHttpClientAuthenticator : IRemoteServiceHttpClientAuthenticator, ITransientDependency { - public IHttpContextAccessor HttpContextAccessor { get; set; } - protected IIdentityModelAuthenticationService IdentityModelAuthenticationService { get; } public IdentityModelRemoteServiceHttpClientAuthenticator( @@ -21,33 +17,12 @@ namespace Volo.Abp.Http.Client.IdentityModel IdentityModelAuthenticationService = identityModelAuthenticationService; } - public async Task Authenticate(RemoteServiceHttpClientAuthenticateContext context) + public virtual async Task Authenticate(RemoteServiceHttpClientAuthenticateContext context) { - if (context.RemoteService.GetUseCurrentAccessToken() != false) - { - var accessToken = await GetAccessTokenFromHttpContextOrNullAsync(); - if (accessToken != null) - { - context.Request.SetBearerToken(accessToken); - return; - } - } - await IdentityModelAuthenticationService.TryAuthenticateAsync( context.Client, context.RemoteService.GetIdentityClient() ); } - - protected virtual async Task GetAccessTokenFromHttpContextOrNullAsync() - { - var httpContext = HttpContextAccessor?.HttpContext; - if (httpContext == null) - { - return null; - } - - return await httpContext.GetTokenAsync("access_token"); - } } } From adeeb0d5a1cc822e172a6f0752e1759790db2452 Mon Sep 17 00:00:00 2001 From: maliming Date: Fri, 21 Feb 2020 18:50:52 +0800 Subject: [PATCH 04/56] Fixed the bug that the controller was not logged & Filter the controller in AbpAuditingMiddleware. Resolve #2819 --- .../Mvc/Auditing/AbpAuditActionFilter.cs | 6 --- .../Auditing/AbpAuditingMiddleware.cs | 16 ++++++- .../Mvc/Auditing/AuditTestController.cs | 1 - .../Volo/Abp/Auditing/Auditing_Tests.cs | 43 +++++++++++++------ .../Volo/Abp/Account/AccountAppService.cs | 6 +-- .../Account/Controllers/AccountController.cs | 2 +- .../Pages/Account/Login.cshtml.cs | 2 +- .../Identity/IdentityRoleRepository_Tests.cs | 2 +- 8 files changed, 50 insertions(+), 28 deletions(-) diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Auditing/AbpAuditActionFilter.cs b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Auditing/AbpAuditActionFilter.cs index 33932137cb..0ee62f9b65 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Auditing/AbpAuditActionFilter.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Auditing/AbpAuditActionFilter.cs @@ -84,12 +84,6 @@ namespace Volo.Abp.AspNetCore.Mvc.Auditing return false; } - //TODO: This is partially duplication of AuditHelper.ShouldSaveAudit method. Check why it does not work for controllers - if (!AuditingInterceptorRegistrar.ShouldAuditTypeByDefault(context.Controller.GetType())) - { - return false; - } - auditLog = auditLogScope.Log; auditLogAction = _auditingHelper.CreateAuditLogAction( auditLog, diff --git a/framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/Auditing/AbpAuditingMiddleware.cs b/framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/Auditing/AbpAuditingMiddleware.cs index f59c5b6b3a..ceff8c5029 100644 --- a/framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/Auditing/AbpAuditingMiddleware.cs +++ b/framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/Auditing/AbpAuditingMiddleware.cs @@ -1,7 +1,9 @@ -using System; +using System; using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Mvc.Abstractions; +using Microsoft.AspNetCore.Mvc.Controllers; using Microsoft.Extensions.Options; using Volo.Abp.Auditing; using Volo.Abp.DependencyInjection; @@ -62,6 +64,18 @@ namespace Volo.Abp.AspNetCore.Auditing return false; } + var endpoint = httpContext.GetEndpoint(); + if (endpoint == null) + { + return false; + } + + var actionDescriptor = endpoint.Metadata.GetMetadata(); + if (actionDescriptor != null && !(actionDescriptor is ControllerActionDescriptor)) + { + return false; + } + if (Options.AlwaysLogOnException && hasError) { return true; diff --git a/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/Auditing/AuditTestController.cs b/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/Auditing/AuditTestController.cs index 3c8d5dc4db..49dfef9db8 100644 --- a/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/Auditing/AuditTestController.cs +++ b/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/Auditing/AuditTestController.cs @@ -5,7 +5,6 @@ using Volo.Abp.Auditing; namespace Volo.Abp.AspNetCore.Mvc.Auditing { [Route("api/audit-test")] - [Audited] public class AuditTestController : AbpController { private readonly AbpAuditingOptions _options; diff --git a/framework/test/Volo.Abp.Auditing.Tests/Volo/Abp/Auditing/Auditing_Tests.cs b/framework/test/Volo.Abp.Auditing.Tests/Volo/Abp/Auditing/Auditing_Tests.cs index bc41f3bcde..9837ca3ac2 100644 --- a/framework/test/Volo.Abp.Auditing.Tests/Volo/Abp/Auditing/Auditing_Tests.cs +++ b/framework/test/Volo.Abp.Auditing.Tests/Volo/Abp/Auditing/Auditing_Tests.cs @@ -34,8 +34,8 @@ namespace Volo.Abp.Auditing using (var scope = _auditingManager.BeginScope()) { - await myAuditedObject1.DoItAsync(new InputObject { Value1 = "forty-two", Value2 = 42 }).ConfigureAwait(false); - await scope.SaveAsync().ConfigureAwait(false); + await myAuditedObject1.DoItAsync(new InputObject { Value1 = "forty-two", Value2 = 42 }); + await scope.SaveAsync(); } #pragma warning disable 4014 @@ -80,8 +80,8 @@ namespace Volo.Abp.Auditing using (var scope = _auditingManager.BeginScope()) { var repository = ServiceProvider.GetRequiredService>(); - await repository.InsertAsync(new AppEntityWithAudited(Guid.NewGuid(), "test name")).ConfigureAwait(false); - await scope.SaveAsync().ConfigureAwait(false); + await repository.InsertAsync(new AppEntityWithAudited(Guid.NewGuid(), "test name")); + await scope.SaveAsync(); } #pragma warning disable 4014 @@ -95,8 +95,8 @@ namespace Volo.Abp.Auditing using (var scope = _auditingManager.BeginScope()) { var repository = ServiceProvider.GetRequiredService>(); - await repository.InsertAsync(new AppEntityWithAuditedAndPropertyHasDisableAuditing(Guid.NewGuid(), "test name", "test name2")).ConfigureAwait(false); - await scope.SaveAsync().ConfigureAwait(false); + await repository.InsertAsync(new AppEntityWithAuditedAndPropertyHasDisableAuditing(Guid.NewGuid(), "test name", "test name2")); + await scope.SaveAsync(); } #pragma warning disable 4014 @@ -113,8 +113,8 @@ namespace Volo.Abp.Auditing using (var scope = _auditingManager.BeginScope()) { var repository = ServiceProvider.GetRequiredService>(); - await repository.InsertAsync(new AppEntityWithDisableAuditing(Guid.NewGuid(), "test name")).ConfigureAwait(false); - await scope.SaveAsync().ConfigureAwait(false); + await repository.InsertAsync(new AppEntityWithDisableAuditing(Guid.NewGuid(), "test name")); + await scope.SaveAsync(); } #pragma warning disable 4014 @@ -128,8 +128,8 @@ namespace Volo.Abp.Auditing using (var scope = _auditingManager.BeginScope()) { var repository = ServiceProvider.GetRequiredService>(); - await repository.InsertAsync(new AppEntityWithSelector(Guid.NewGuid(), "test name")).ConfigureAwait(false); - await scope.SaveAsync().ConfigureAwait(false); + await repository.InsertAsync(new AppEntityWithSelector(Guid.NewGuid(), "test name")); + await scope.SaveAsync(); } #pragma warning disable 4014 @@ -143,8 +143,8 @@ namespace Volo.Abp.Auditing using (var scope = _auditingManager.BeginScope()) { var repository = ServiceProvider.GetRequiredService>(); - await repository.InsertAsync(new AppEntityWithPropertyHasAudited(Guid.NewGuid(), "test name")).ConfigureAwait(false); - await scope.SaveAsync().ConfigureAwait(false); + await repository.InsertAsync(new AppEntityWithPropertyHasAudited(Guid.NewGuid(), "test name")); + await scope.SaveAsync(); } #pragma warning disable 4014 @@ -158,8 +158,8 @@ namespace Volo.Abp.Auditing using (var scope = _auditingManager.BeginScope()) { var repository = ServiceProvider.GetRequiredService>(); - await repository.InsertAsync(new AppEntityWithDisableAuditingAndPropertyHasAudited(Guid.NewGuid(), "test name", "test name2")).ConfigureAwait(false); - await scope.SaveAsync().ConfigureAwait(false); + await repository.InsertAsync(new AppEntityWithDisableAuditingAndPropertyHasAudited(Guid.NewGuid(), "test name", "test name2")); + await scope.SaveAsync(); } #pragma warning disable 4014 @@ -169,5 +169,20 @@ namespace Volo.Abp.Auditing nameof(AppEntityWithDisableAuditingAndPropertyHasAudited.Name))); #pragma warning restore 4014 } + + + [Fact] + public virtual async Task Should_Not_Write_AuditLog_If_There_No_Action_And_No_EntityChanges() + { + using (var scope = _auditingManager.BeginScope()) + { + await scope.SaveAsync(); + } + +#pragma warning disable 4014 + _auditingStore.DidNotReceive().SaveAsync(Arg.Any()); +#pragma warning restore 4014 + } + } } diff --git a/modules/account/src/Volo.Abp.Account.Application/Volo/Abp/Account/AccountAppService.cs b/modules/account/src/Volo.Abp.Account.Application/Volo/Abp/Account/AccountAppService.cs index 695d9b233f..31de74efde 100644 --- a/modules/account/src/Volo.Abp.Account.Application/Volo/Abp/Account/AccountAppService.cs +++ b/modules/account/src/Volo.Abp.Account.Application/Volo/Abp/Account/AccountAppService.cs @@ -29,7 +29,7 @@ namespace Volo.Abp.Account (await UserManager.CreateAsync(user, input.Password)).CheckErrors(); - await UserManager.SetEmailAsync(user,input.EmailAddress).ConfigureAwait(false); + await UserManager.SetEmailAsync(user,input.EmailAddress); await SetDefaultRolesAsync(user); @@ -38,9 +38,9 @@ namespace Volo.Abp.Account protected virtual async Task SetDefaultRolesAsync(IdentityUser user) { - var defaultRoles = await _roleRepository.GetDefaultOnesAsync().ConfigureAwait(false); + var defaultRoles = await _roleRepository.GetDefaultOnesAsync(); - await UserManager.SetRolesAsync(user, defaultRoles.Select(r => r.Name)).ConfigureAwait(false); + await UserManager.SetRolesAsync(user, defaultRoles.Select(r => r.Name)); } protected virtual async Task CheckSelfRegistrationAsync() diff --git a/modules/account/src/Volo.Abp.Account.Web/Areas/Account/Controllers/AccountController.cs b/modules/account/src/Volo.Abp.Account.Web/Areas/Account/Controllers/AccountController.cs index 48b8da5c38..d916368c39 100644 --- a/modules/account/src/Volo.Abp.Account.Web/Areas/Account/Controllers/AccountController.cs +++ b/modules/account/src/Volo.Abp.Account.Web/Areas/Account/Controllers/AccountController.cs @@ -145,7 +145,7 @@ namespace Volo.Abp.Account.Web.Areas.Account.Controllers private async Task CheckLocalLoginAsync() { - if (!await _settingProvider.IsTrueAsync(AccountSettingNames.EnableLocalLogin).ConfigureAwait(false)) + if (!await _settingProvider.IsTrueAsync(AccountSettingNames.EnableLocalLogin)) { throw new UserFriendlyException(L["LocalLoginDisabledMessage"]); } diff --git a/modules/account/src/Volo.Abp.Account.Web/Pages/Account/Login.cshtml.cs b/modules/account/src/Volo.Abp.Account.Web/Pages/Account/Login.cshtml.cs index 53954fd9e4..7857537acb 100644 --- a/modules/account/src/Volo.Abp.Account.Web/Pages/Account/Login.cshtml.cs +++ b/modules/account/src/Volo.Abp.Account.Web/Pages/Account/Login.cshtml.cs @@ -240,7 +240,7 @@ namespace Volo.Abp.Account.Web.Pages.Account protected virtual async Task CheckLocalLoginAsync() { - if (!await SettingProvider.IsTrueAsync(AccountSettingNames.EnableLocalLogin).ConfigureAwait(false)) + if (!await SettingProvider.IsTrueAsync(AccountSettingNames.EnableLocalLogin)) { throw new UserFriendlyException(L["LocalLoginDisabledMessage"]); } diff --git a/modules/identity/test/Volo.Abp.Identity.TestBase/Volo/Abp/Identity/IdentityRoleRepository_Tests.cs b/modules/identity/test/Volo.Abp.Identity.TestBase/Volo/Abp/Identity/IdentityRoleRepository_Tests.cs index eb22de0600..1f65dd821f 100644 --- a/modules/identity/test/Volo.Abp.Identity.TestBase/Volo/Abp/Identity/IdentityRoleRepository_Tests.cs +++ b/modules/identity/test/Volo.Abp.Identity.TestBase/Volo/Abp/Identity/IdentityRoleRepository_Tests.cs @@ -39,7 +39,7 @@ namespace Volo.Abp.Identity [Fact] public async Task GetDefaultOnesAsync() { - var roles = await RoleRepository.GetDefaultOnesAsync().ConfigureAwait(false); + var roles = await RoleRepository.GetDefaultOnesAsync(); foreach (var role in roles) { From f20a6f0d433024591d20ec20d248d304868ded9f Mon Sep 17 00:00:00 2001 From: maliming Date: Fri, 21 Feb 2020 19:07:39 +0800 Subject: [PATCH 05/56] Merge null check expressions. --- .../Abp/AspNetCore/Auditing/AbpAuditingMiddleware.cs | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/Auditing/AbpAuditingMiddleware.cs b/framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/Auditing/AbpAuditingMiddleware.cs index ceff8c5029..10bc9545d7 100644 --- a/framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/Auditing/AbpAuditingMiddleware.cs +++ b/framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/Auditing/AbpAuditingMiddleware.cs @@ -65,13 +65,8 @@ namespace Volo.Abp.AspNetCore.Auditing } var endpoint = httpContext.GetEndpoint(); - if (endpoint == null) - { - return false; - } - - var actionDescriptor = endpoint.Metadata.GetMetadata(); - if (actionDescriptor != null && !(actionDescriptor is ControllerActionDescriptor)) + var actionDescriptor = endpoint?.Metadata.GetMetadata(); + if (!(actionDescriptor is ControllerActionDescriptor)) { return false; } From 75bb5d645327a839af9fb6285d7a195d84339b3c Mon Sep 17 00:00:00 2001 From: Necati Meral Date: Fri, 21 Feb 2020 16:01:26 +0100 Subject: [PATCH 06/56] Implemented `IParameterTypeComparer` to be used in `ApiDescriptionFinder` The `CrossPlatformParameterTypeComparer` handles type differences in .net-core and .net-framework by replacing the assembly names with placeholders. This implementation works in all environments because the `CrossPlatformParameterTypeComparer` inherits the default behavior and (once) checks the current framework. --- .../DynamicProxying/ApiDescriptionFinder.cs | 10 +++-- .../CrossPlatformParameterTypeComparer.cs | 43 ++++++++++++++++++ .../DynamicProxying/EnvironmentHelper.cs | 44 +++++++++++++++++++ .../DynamicProxying/IParameterTypeComparer.cs | 19 ++++++++ .../DynamicProxying/ParameterTypeComparer.cs | 16 +++++++ 5 files changed, 129 insertions(+), 3 deletions(-) create mode 100644 framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/DynamicProxying/CrossPlatformParameterTypeComparer.cs create mode 100644 framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/DynamicProxying/EnvironmentHelper.cs create mode 100644 framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/DynamicProxying/IParameterTypeComparer.cs create mode 100644 framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/DynamicProxying/ParameterTypeComparer.cs diff --git a/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/DynamicProxying/ApiDescriptionFinder.cs b/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/DynamicProxying/ApiDescriptionFinder.cs index 9b9c8e804c..6f8b5da376 100644 --- a/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/DynamicProxying/ApiDescriptionFinder.cs +++ b/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/DynamicProxying/ApiDescriptionFinder.cs @@ -18,17 +18,21 @@ namespace Volo.Abp.Http.Client.DynamicProxying protected IApiDescriptionCache Cache { get; } + protected IParameterTypeComparer ParameterTypeComparer { get; } + private static readonly JsonSerializerSettings SharedJsonSerializerSettings = new JsonSerializerSettings { ContractResolver = new CamelCasePropertyNamesContractResolver() }; public ApiDescriptionFinder( - IApiDescriptionCache cache, - IDynamicProxyHttpClientFactory httpClientFactory) + IApiDescriptionCache cache, + IDynamicProxyHttpClientFactory httpClientFactory, + IParameterTypeComparer parameterTypeComparer) { Cache = cache; HttpClientFactory = httpClientFactory; + ParameterTypeComparer = parameterTypeComparer; CancellationTokenProvider = NullCancellationTokenProvider.Instance; } @@ -57,7 +61,7 @@ namespace Volo.Abp.Http.Client.DynamicProxying for (int i = 0; i < methodParameters.Length; i++) { - if (action.ParametersOnMethod[i].TypeAsString != methodParameters[i].ParameterType.GetFullNameWithAssemblyName()) + if (!ParameterTypeComparer.TypeMatches(action.ParametersOnMethod[i], methodParameters[i])) { found = false; break; diff --git a/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/DynamicProxying/CrossPlatformParameterTypeComparer.cs b/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/DynamicProxying/CrossPlatformParameterTypeComparer.cs new file mode 100644 index 0000000000..e9142ffe3f --- /dev/null +++ b/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/DynamicProxying/CrossPlatformParameterTypeComparer.cs @@ -0,0 +1,43 @@ +using System; +using System.Collections.Generic; +using System.Reflection; +using System.Text; +using Volo.Abp.DependencyInjection; +using Volo.Abp.Http.Modeling; + +namespace Volo.Abp.Http.Client.DynamicProxying +{ + /// + /// Compares the server-side parameter-type with the local parameter-type considering differences between + /// the .net-core and the traditional .net-framework. + /// Inspired by 'https://github.com/akkadotnet/akka.net/pull/2947/files' + /// + public class CrossPlatformParameterTypeComparer : ParameterTypeComparer, ITransientDependency + { + const string Placeholder = "%COREFX%"; + const string NetCoreLib = "System.Private.CoreLib"; + const string NetFxLib = "mscorlib"; + + static readonly bool runsOnNetFx; + + static CrossPlatformParameterTypeComparer() + { + runsOnNetFx = string.IsNullOrEmpty(EnvironmentHelper.RuntimeNetCoreVersion); + } + + public override bool TypeMatches(MethodParameterApiDescriptionModel actionParameter, ParameterInfo methodParameter) + { + if (runsOnNetFx) + { + // Compare the server's DotnetCore type relative to the current, traditional framework type + // by replacing framework assemblies with an placeholder string. + return actionParameter.TypeAsString.Replace(NetCoreLib, Placeholder) + == methodParameter.ParameterType.GetFullNameWithAssemblyName().Replace(NetFxLib, Placeholder); + } + else + { + return base.TypeMatches(actionParameter, methodParameter); + } + } + } +} diff --git a/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/DynamicProxying/EnvironmentHelper.cs b/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/DynamicProxying/EnvironmentHelper.cs new file mode 100644 index 0000000000..0ed914e419 --- /dev/null +++ b/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/DynamicProxying/EnvironmentHelper.cs @@ -0,0 +1,44 @@ +using System; +using System.Collections.Generic; +using System.Reflection; +using System.Text; + +namespace Volo.Abp.Http.Client.DynamicProxying +{ + /// + /// Provide helpers to check the environment where the current ABP app is currently running + /// + static class EnvironmentHelper + { + /// + /// Initializes the class. + /// + static EnvironmentHelper() + { + RuntimeNetCoreVersion = GetNetCoreVersion(); + } + + /// + /// Gets the runtime net core version. + /// + /// + /// If the is null the app is running on a .net Classic environment + /// + public static string RuntimeNetCoreVersion { get; } + + /// + /// Gets the net core version. + /// + static string GetNetCoreVersion() + { + var assembly = typeof(System.Runtime.GCSettings).GetTypeInfo().Assembly; + var assemblyPath = assembly.CodeBase.Split(new[] { '/', '\\' }, StringSplitOptions.RemoveEmptyEntries); + int netCoreAppIndex = Array.IndexOf(assemblyPath, "Microsoft.NETCore.App"); + if (netCoreAppIndex > 0 && netCoreAppIndex < assemblyPath.Length - 2) + { + return assemblyPath[netCoreAppIndex + 1]; + } + return null; + } + } +} diff --git a/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/DynamicProxying/IParameterTypeComparer.cs b/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/DynamicProxying/IParameterTypeComparer.cs new file mode 100644 index 0000000000..079029bf93 --- /dev/null +++ b/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/DynamicProxying/IParameterTypeComparer.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; +using System.Reflection; +using System.Text; +using Volo.Abp.Http.Modeling; + +namespace Volo.Abp.Http.Client.DynamicProxying +{ + public interface IParameterTypeComparer + { + /// + /// Compares the given parameters. + /// + /// The parameter description retreived from the server (depends on the server's runtime) + /// The local parameter info (depends on the client's runtime) + /// + public bool TypeMatches(MethodParameterApiDescriptionModel actionParameter, ParameterInfo methodParameter); + } +} diff --git a/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/DynamicProxying/ParameterTypeComparer.cs b/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/DynamicProxying/ParameterTypeComparer.cs new file mode 100644 index 0000000000..6551ba3108 --- /dev/null +++ b/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/DynamicProxying/ParameterTypeComparer.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Reflection; +using System.Text; +using Volo.Abp.Http.Modeling; + +namespace Volo.Abp.Http.Client.DynamicProxying +{ + public class ParameterTypeComparer : IParameterTypeComparer + { + public virtual bool TypeMatches(MethodParameterApiDescriptionModel actionParameter, ParameterInfo methodParameter) + { + return actionParameter.TypeAsString == methodParameter.ParameterType.GetFullNameWithAssemblyName(); + } + } +} From 4a0af3e4bac47b2c172608c2882e8324c33285b0 Mon Sep 17 00:00:00 2001 From: liangshiwei Date: Sun, 23 Feb 2020 20:29:21 +0800 Subject: [PATCH 07/56] quartz.net background job&worker integration --- framework/Volo.Abp.sln | 32 ++++++++++++--- .../FodyWeavers.xml | 3 ++ .../FodyWeavers.xsd | 30 ++++++++++++++ .../Volo.Abp.BackgroundJobs.Quartz.csproj | 22 ++++++++++ .../Quartz/AbpBackgroundJobsQuartzModule.cs | 18 ++++++++ .../Quartz/QuartzBackgroundJobManager.cs | 29 +++++++++++++ .../Quartz/QuartzJobExecutionAdapter.cs | 37 +++++++++++++++++ .../FodyWeavers.xml | 3 ++ .../FodyWeavers.xsd | 30 ++++++++++++++ .../Volo.Abp.BackgroundWorkers.Quartz.csproj | 24 +++++++++++ .../AbpBackgroundWorkersQuartzModule.cs | 37 +++++++++++++++++ .../Quartz/AbpQuartzConventionalRegistrar.cs | 20 +++++++++ .../Quartz/IQuartzBackgroundWorker.cs | 10 +++++ .../Quartz/QuartzBackgroundWorkerBase.cs | 15 +++++++ .../Quartz/QuartzBackgroundWorkerManager.cs | 41 +++++++++++++++++++ framework/src/Volo.Abp.Quartz/FodyWeavers.xml | 3 ++ framework/src/Volo.Abp.Quartz/FodyWeavers.xsd | 30 ++++++++++++++ .../AbpQuartzServiceCollectionExtensions.cs | 16 ++++++++ .../Volo.Abp.Quartz/Volo.Abp.Quartz.csproj | 25 +++++++++++ .../Volo/Abp/Quartz/AbpQuartzJobFactory.cs | 26 ++++++++++++ .../Volo/Abp/Quartz/AbpQuartzModule.cs | 32 +++++++++++++++ .../Volo/Abp/Quartz/AbpQuartzPreOptions.cs | 10 +++++ 22 files changed, 488 insertions(+), 5 deletions(-) create mode 100644 framework/src/Volo.Abp.BackgroundJobs.Quartz/FodyWeavers.xml create mode 100644 framework/src/Volo.Abp.BackgroundJobs.Quartz/FodyWeavers.xsd create mode 100644 framework/src/Volo.Abp.BackgroundJobs.Quartz/Volo.Abp.BackgroundJobs.Quartz.csproj create mode 100644 framework/src/Volo.Abp.BackgroundJobs.Quartz/Volo/Abp/BackgroundJobs/Quartz/AbpBackgroundJobsQuartzModule.cs create mode 100644 framework/src/Volo.Abp.BackgroundJobs.Quartz/Volo/Abp/BackgroundJobs/Quartz/QuartzBackgroundJobManager.cs create mode 100644 framework/src/Volo.Abp.BackgroundJobs.Quartz/Volo/Abp/BackgroundJobs/Quartz/QuartzJobExecutionAdapter.cs create mode 100644 framework/src/Volo.Abp.BackgroundWorkers.Quartz/FodyWeavers.xml create mode 100644 framework/src/Volo.Abp.BackgroundWorkers.Quartz/FodyWeavers.xsd create mode 100644 framework/src/Volo.Abp.BackgroundWorkers.Quartz/Volo.Abp.BackgroundWorkers.Quartz.csproj create mode 100644 framework/src/Volo.Abp.BackgroundWorkers.Quartz/Volo/Abp/BackgroundWorkers/Quartz/AbpBackgroundWorkersQuartzModule.cs create mode 100644 framework/src/Volo.Abp.BackgroundWorkers.Quartz/Volo/Abp/BackgroundWorkers/Quartz/AbpQuartzConventionalRegistrar.cs create mode 100644 framework/src/Volo.Abp.BackgroundWorkers.Quartz/Volo/Abp/BackgroundWorkers/Quartz/IQuartzBackgroundWorker.cs create mode 100644 framework/src/Volo.Abp.BackgroundWorkers.Quartz/Volo/Abp/BackgroundWorkers/Quartz/QuartzBackgroundWorkerBase.cs create mode 100644 framework/src/Volo.Abp.BackgroundWorkers.Quartz/Volo/Abp/BackgroundWorkers/Quartz/QuartzBackgroundWorkerManager.cs create mode 100644 framework/src/Volo.Abp.Quartz/FodyWeavers.xml create mode 100644 framework/src/Volo.Abp.Quartz/FodyWeavers.xsd create mode 100644 framework/src/Volo.Abp.Quartz/Microsoft/Extensions/DependencyInjection/AbpQuartzServiceCollectionExtensions.cs create mode 100644 framework/src/Volo.Abp.Quartz/Volo.Abp.Quartz.csproj create mode 100644 framework/src/Volo.Abp.Quartz/Volo/Abp/Quartz/AbpQuartzJobFactory.cs create mode 100644 framework/src/Volo.Abp.Quartz/Volo/Abp/Quartz/AbpQuartzModule.cs create mode 100644 framework/src/Volo.Abp.Quartz/Volo/Abp/Quartz/AbpQuartzPreOptions.cs diff --git a/framework/Volo.Abp.sln b/framework/Volo.Abp.sln index b731aff187..ac36745e0f 100644 --- a/framework/Volo.Abp.sln +++ b/framework/Volo.Abp.sln @@ -1,4 +1,5 @@ -Microsoft Visual Studio Solution File, Format Version 12.00 + +Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 16 VisualStudioVersion = 16.0.28922.388 MinimumVisualStudioVersion = 10.0.40219.1 @@ -252,13 +253,19 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Volo.Abp.ObjectMapping.Test EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Volo.Abp.Ddd.Application.Contracts", "src\Volo.Abp.Ddd.Application.Contracts\Volo.Abp.Ddd.Application.Contracts.csproj", "{73559227-EBF0-475F-835B-1FF0CD9132AA}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Volo.Abp.Minify", "src\Volo.Abp.Minify\Volo.Abp.Minify.csproj", "{928DC30D-C078-4BB4-A9F8-FE7252C67DC6}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Volo.Abp.Minify", "src\Volo.Abp.Minify\Volo.Abp.Minify.csproj", "{928DC30D-C078-4BB4-A9F8-FE7252C67DC6}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Volo.Abp.Minify.Tests", "test\Volo.Abp.Minify.Tests\Volo.Abp.Minify.Tests.csproj", "{E69182B3-350A-43F5-A935-5EBBEBECEF97}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Volo.Abp.Minify.Tests", "test\Volo.Abp.Minify.Tests\Volo.Abp.Minify.Tests.csproj", "{E69182B3-350A-43F5-A935-5EBBEBECEF97}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Volo.Abp.AspNetCore.Serilog", "src\Volo.Abp.AspNetCore.Serilog\Volo.Abp.AspNetCore.Serilog.csproj", "{3B801003-BE74-49ED-9749-DA5E99F45EBF}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Volo.Abp.AspNetCore.Serilog", "src\Volo.Abp.AspNetCore.Serilog\Volo.Abp.AspNetCore.Serilog.csproj", "{3B801003-BE74-49ED-9749-DA5E99F45EBF}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Volo.Abp.AspNetCore.Serilog.Tests", "test\Volo.Abp.AspNetCore.Serilog.Tests\Volo.Abp.AspNetCore.Serilog.Tests.csproj", "{9CAA07ED-FE5C-4427-A6FA-6C6CB5B4CC62}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Volo.Abp.AspNetCore.Serilog.Tests", "test\Volo.Abp.AspNetCore.Serilog.Tests\Volo.Abp.AspNetCore.Serilog.Tests.csproj", "{9CAA07ED-FE5C-4427-A6FA-6C6CB5B4CC62}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Volo.Abp.BackgroundJobs.Quartz", "src\Volo.Abp.BackgroundJobs.Quartz\Volo.Abp.BackgroundJobs.Quartz.csproj", "{2307198B-5837-4F05-AA84-D6EC2A923D69}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Volo.Abp.Quartz", "src\Volo.Abp.Quartz\Volo.Abp.Quartz.csproj", "{9467418B-4A9B-4093-9B31-01A9DEF5B372}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Volo.Abp.BackgroundWorkers.Quartz", "src\Volo.Abp.BackgroundWorkers.Quartz\Volo.Abp.BackgroundWorkers.Quartz.csproj", "{CD5770BB-2E0C-4B3C-80E0-21B8CC43DBA9}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -774,6 +781,18 @@ Global {9CAA07ED-FE5C-4427-A6FA-6C6CB5B4CC62}.Debug|Any CPU.Build.0 = Debug|Any CPU {9CAA07ED-FE5C-4427-A6FA-6C6CB5B4CC62}.Release|Any CPU.ActiveCfg = Release|Any CPU {9CAA07ED-FE5C-4427-A6FA-6C6CB5B4CC62}.Release|Any CPU.Build.0 = Release|Any CPU + {2307198B-5837-4F05-AA84-D6EC2A923D69}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {2307198B-5837-4F05-AA84-D6EC2A923D69}.Debug|Any CPU.Build.0 = Debug|Any CPU + {2307198B-5837-4F05-AA84-D6EC2A923D69}.Release|Any CPU.ActiveCfg = Release|Any CPU + {2307198B-5837-4F05-AA84-D6EC2A923D69}.Release|Any CPU.Build.0 = Release|Any CPU + {9467418B-4A9B-4093-9B31-01A9DEF5B372}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {9467418B-4A9B-4093-9B31-01A9DEF5B372}.Debug|Any CPU.Build.0 = Debug|Any CPU + {9467418B-4A9B-4093-9B31-01A9DEF5B372}.Release|Any CPU.ActiveCfg = Release|Any CPU + {9467418B-4A9B-4093-9B31-01A9DEF5B372}.Release|Any CPU.Build.0 = Release|Any CPU + {CD5770BB-2E0C-4B3C-80E0-21B8CC43DBA9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {CD5770BB-2E0C-4B3C-80E0-21B8CC43DBA9}.Debug|Any CPU.Build.0 = Debug|Any CPU + {CD5770BB-2E0C-4B3C-80E0-21B8CC43DBA9}.Release|Any CPU.ActiveCfg = Release|Any CPU + {CD5770BB-2E0C-4B3C-80E0-21B8CC43DBA9}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -906,6 +925,9 @@ Global {E69182B3-350A-43F5-A935-5EBBEBECEF97} = {447C8A77-E5F0-4538-8687-7383196D04EA} {3B801003-BE74-49ED-9749-DA5E99F45EBF} = {5DF0E140-0513-4D0D-BE2E-3D4D85CD70E6} {9CAA07ED-FE5C-4427-A6FA-6C6CB5B4CC62} = {447C8A77-E5F0-4538-8687-7383196D04EA} + {2307198B-5837-4F05-AA84-D6EC2A923D69} = {5DF0E140-0513-4D0D-BE2E-3D4D85CD70E6} + {9467418B-4A9B-4093-9B31-01A9DEF5B372} = {5DF0E140-0513-4D0D-BE2E-3D4D85CD70E6} + {CD5770BB-2E0C-4B3C-80E0-21B8CC43DBA9} = {5DF0E140-0513-4D0D-BE2E-3D4D85CD70E6} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {BB97ECF4-9A84-433F-A80B-2A3285BDD1D5} diff --git a/framework/src/Volo.Abp.BackgroundJobs.Quartz/FodyWeavers.xml b/framework/src/Volo.Abp.BackgroundJobs.Quartz/FodyWeavers.xml new file mode 100644 index 0000000000..be0de3a908 --- /dev/null +++ b/framework/src/Volo.Abp.BackgroundJobs.Quartz/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/framework/src/Volo.Abp.BackgroundJobs.Quartz/FodyWeavers.xsd b/framework/src/Volo.Abp.BackgroundJobs.Quartz/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/framework/src/Volo.Abp.BackgroundJobs.Quartz/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/framework/src/Volo.Abp.BackgroundJobs.Quartz/Volo.Abp.BackgroundJobs.Quartz.csproj b/framework/src/Volo.Abp.BackgroundJobs.Quartz/Volo.Abp.BackgroundJobs.Quartz.csproj new file mode 100644 index 0000000000..67c07f77d6 --- /dev/null +++ b/framework/src/Volo.Abp.BackgroundJobs.Quartz/Volo.Abp.BackgroundJobs.Quartz.csproj @@ -0,0 +1,22 @@ + + + + + + + netstandard2.0 + Volo.Abp.BackgroundJobs.Quartz + Volo.Abp.BackgroundJobs.Quartz + $(AssetTargetFallback);portable-net45+win8+wp8+wpa81; + false + false + false + + + + + + + + + diff --git a/framework/src/Volo.Abp.BackgroundJobs.Quartz/Volo/Abp/BackgroundJobs/Quartz/AbpBackgroundJobsQuartzModule.cs b/framework/src/Volo.Abp.BackgroundJobs.Quartz/Volo/Abp/BackgroundJobs/Quartz/AbpBackgroundJobsQuartzModule.cs new file mode 100644 index 0000000000..d5f84ed91e --- /dev/null +++ b/framework/src/Volo.Abp.BackgroundJobs.Quartz/Volo/Abp/BackgroundJobs/Quartz/AbpBackgroundJobsQuartzModule.cs @@ -0,0 +1,18 @@ +using Microsoft.Extensions.DependencyInjection; +using Volo.Abp.Modularity; +using Volo.Abp.Quartz; + +namespace Volo.Abp.BackgroundJobs.Quartz +{ + [DependsOn( + typeof(AbpBackgroundJobsAbstractionsModule), + typeof(AbpQuartzModule) + )] + public class AbpBackgroundJobsQuartzModule :AbpModule + { + public override void ConfigureServices(ServiceConfigurationContext context) + { + context.Services.AddTransient(typeof(QuartzJobExecutionAdapter<>)); + } + } +} diff --git a/framework/src/Volo.Abp.BackgroundJobs.Quartz/Volo/Abp/BackgroundJobs/Quartz/QuartzBackgroundJobManager.cs b/framework/src/Volo.Abp.BackgroundJobs.Quartz/Volo/Abp/BackgroundJobs/Quartz/QuartzBackgroundJobManager.cs new file mode 100644 index 0000000000..ebc1e747d0 --- /dev/null +++ b/framework/src/Volo.Abp.BackgroundJobs.Quartz/Volo/Abp/BackgroundJobs/Quartz/QuartzBackgroundJobManager.cs @@ -0,0 +1,29 @@ +using System; +using System.Threading.Tasks; +using Quartz; +using Volo.Abp.DependencyInjection; + +namespace Volo.Abp.BackgroundJobs.Quartz +{ + [Dependency(ReplaceServices = true)] + public class QuartzBackgroundJobManager : IBackgroundJobManager, ITransientDependency + { + private readonly IScheduler _scheduler; + + public QuartzBackgroundJobManager(IScheduler scheduler) + { + _scheduler = scheduler; + } + + public async Task EnqueueAsync(TArgs args, BackgroundJobPriority priority = BackgroundJobPriority.Normal, + TimeSpan? delay = null) + { + var jobDetail = JobBuilder.Create>().SetJobData(new JobDataMap { { nameof(TArgs), args } }).Build(); + var trigger = !delay.HasValue ? TriggerBuilder.Create().StartNow().Build() : TriggerBuilder.Create().StartAt(new DateTimeOffset(DateTime.Now.Add(delay.Value))).Build(); + + await _scheduler.ScheduleJob(jobDetail, trigger); + + return jobDetail.Key.ToString(); + } + } +} diff --git a/framework/src/Volo.Abp.BackgroundJobs.Quartz/Volo/Abp/BackgroundJobs/Quartz/QuartzJobExecutionAdapter.cs b/framework/src/Volo.Abp.BackgroundJobs.Quartz/Volo/Abp/BackgroundJobs/Quartz/QuartzJobExecutionAdapter.cs new file mode 100644 index 0000000000..614c09af2c --- /dev/null +++ b/framework/src/Volo.Abp.BackgroundJobs.Quartz/Volo/Abp/BackgroundJobs/Quartz/QuartzJobExecutionAdapter.cs @@ -0,0 +1,37 @@ +using System.Threading.Tasks; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Options; +using Quartz; +using Volo.Abp.DependencyInjection; + +namespace Volo.Abp.BackgroundJobs.Quartz +{ + public class QuartzJobExecutionAdapter : IJob, ITransientDependency + { + protected AbpBackgroundJobOptions Options { get; } + protected IServiceScopeFactory ServiceScopeFactory { get; } + protected IBackgroundJobExecuter JobExecuter { get; } + + public QuartzJobExecutionAdapter( + IOptions options, + IBackgroundJobExecuter jobExecuter, + IServiceScopeFactory serviceScopeFactory) + { + JobExecuter = jobExecuter; + ServiceScopeFactory = serviceScopeFactory; + Options = options.Value; + } + + + public async Task Execute(IJobExecutionContext context) + { + using (var scope = ServiceScopeFactory.CreateScope()) + { + var args = (TArgs)context.JobDetail.JobDataMap.Get(nameof(TArgs)); + var jobType = Options.GetJob(typeof(TArgs)).JobType; + var jobContext = new JobExecutionContext(scope.ServiceProvider, jobType, args); + await JobExecuter.ExecuteAsync(jobContext); + } + } + } +} diff --git a/framework/src/Volo.Abp.BackgroundWorkers.Quartz/FodyWeavers.xml b/framework/src/Volo.Abp.BackgroundWorkers.Quartz/FodyWeavers.xml new file mode 100644 index 0000000000..00e1d9a1c1 --- /dev/null +++ b/framework/src/Volo.Abp.BackgroundWorkers.Quartz/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/framework/src/Volo.Abp.BackgroundWorkers.Quartz/FodyWeavers.xsd b/framework/src/Volo.Abp.BackgroundWorkers.Quartz/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/framework/src/Volo.Abp.BackgroundWorkers.Quartz/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/framework/src/Volo.Abp.BackgroundWorkers.Quartz/Volo.Abp.BackgroundWorkers.Quartz.csproj b/framework/src/Volo.Abp.BackgroundWorkers.Quartz/Volo.Abp.BackgroundWorkers.Quartz.csproj new file mode 100644 index 0000000000..1a3ca4e254 --- /dev/null +++ b/framework/src/Volo.Abp.BackgroundWorkers.Quartz/Volo.Abp.BackgroundWorkers.Quartz.csproj @@ -0,0 +1,24 @@ + + + + + + + + netstandard2.0 + Volo.Abp.BackgroundWorkers.Quartz + Volo.Abp.BackgroundWorkers.Quartz + $(AssetTargetFallback);portable-net45+win8+wp8+wpa81; + false + false + false + + + + + + + + + + diff --git a/framework/src/Volo.Abp.BackgroundWorkers.Quartz/Volo/Abp/BackgroundWorkers/Quartz/AbpBackgroundWorkersQuartzModule.cs b/framework/src/Volo.Abp.BackgroundWorkers.Quartz/Volo/Abp/BackgroundWorkers/Quartz/AbpBackgroundWorkersQuartzModule.cs new file mode 100644 index 0000000000..37f9329b10 --- /dev/null +++ b/framework/src/Volo.Abp.BackgroundWorkers.Quartz/Volo/Abp/BackgroundWorkers/Quartz/AbpBackgroundWorkersQuartzModule.cs @@ -0,0 +1,37 @@ +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.DependencyInjection.Extensions; +using Volo.Abp.Modularity; +using Volo.Abp.Quartz; + +namespace Volo.Abp.BackgroundWorkers.Quartz +{ + [DependsOn( + typeof(AbpBackgroundWorkersModule), + typeof(AbpQuartzModule) + )] + public class AbpBackgroundWorkersQuartzModule : AbpModule + { + public override void PreConfigureServices(ServiceConfigurationContext context) + { + context.Services.AddConventionalRegistrar(new AbpQuartzConventionalRegistrar()); + context.Services.Replace(ServiceDescriptor + .Transient()); + + } + + + public override void OnApplicationInitialization(ApplicationInitializationContext context) + { + using (var scope = context.ServiceProvider.CreateScope()) + { + var backgroundWorkerManager = scope.ServiceProvider.GetService(); + var works = scope.ServiceProvider.GetServices(); + + foreach (var work in works) + { + backgroundWorkerManager.Add(work); + } + } + } + } +} diff --git a/framework/src/Volo.Abp.BackgroundWorkers.Quartz/Volo/Abp/BackgroundWorkers/Quartz/AbpQuartzConventionalRegistrar.cs b/framework/src/Volo.Abp.BackgroundWorkers.Quartz/Volo/Abp/BackgroundWorkers/Quartz/AbpQuartzConventionalRegistrar.cs new file mode 100644 index 0000000000..5546c056fd --- /dev/null +++ b/framework/src/Volo.Abp.BackgroundWorkers.Quartz/Volo/Abp/BackgroundWorkers/Quartz/AbpQuartzConventionalRegistrar.cs @@ -0,0 +1,20 @@ +using System; +using Microsoft.Extensions.DependencyInjection; +using Volo.Abp.DependencyInjection; + +namespace Volo.Abp.BackgroundWorkers.Quartz +{ + public class AbpQuartzConventionalRegistrar : ConventionalRegistrarBase + { + public override void AddType(IServiceCollection services, Type type) + { + if (!typeof(IQuartzBackgroundWorker).IsAssignableFrom(type)) + { + return; + } + + services.AddTransient(typeof(IQuartzBackgroundWorker), type); + services.AddTransient(type); + } + } +} diff --git a/framework/src/Volo.Abp.BackgroundWorkers.Quartz/Volo/Abp/BackgroundWorkers/Quartz/IQuartzBackgroundWorker.cs b/framework/src/Volo.Abp.BackgroundWorkers.Quartz/Volo/Abp/BackgroundWorkers/Quartz/IQuartzBackgroundWorker.cs new file mode 100644 index 0000000000..740b6de441 --- /dev/null +++ b/framework/src/Volo.Abp.BackgroundWorkers.Quartz/Volo/Abp/BackgroundWorkers/Quartz/IQuartzBackgroundWorker.cs @@ -0,0 +1,10 @@ +using Quartz; + +namespace Volo.Abp.BackgroundWorkers.Quartz +{ + public interface IQuartzBackgroundWorker : IBackgroundWorker, IJob + { + ITrigger Trigger { get; set; } + IJobDetail JobDetail { get; set; } + } +} diff --git a/framework/src/Volo.Abp.BackgroundWorkers.Quartz/Volo/Abp/BackgroundWorkers/Quartz/QuartzBackgroundWorkerBase.cs b/framework/src/Volo.Abp.BackgroundWorkers.Quartz/Volo/Abp/BackgroundWorkers/Quartz/QuartzBackgroundWorkerBase.cs new file mode 100644 index 0000000000..a72d75b840 --- /dev/null +++ b/framework/src/Volo.Abp.BackgroundWorkers.Quartz/Volo/Abp/BackgroundWorkers/Quartz/QuartzBackgroundWorkerBase.cs @@ -0,0 +1,15 @@ +using System.Threading.Tasks; +using Quartz; + +namespace Volo.Abp.BackgroundWorkers.Quartz +{ + public abstract class QuartzBackgroundWorkerBase : BackgroundWorkerBase, IQuartzBackgroundWorker + { + public ITrigger Trigger { get; set; } + public IJobDetail JobDetail { get; set; } + + + public abstract Task Execute(IJobExecutionContext context); + + } +} diff --git a/framework/src/Volo.Abp.BackgroundWorkers.Quartz/Volo/Abp/BackgroundWorkers/Quartz/QuartzBackgroundWorkerManager.cs b/framework/src/Volo.Abp.BackgroundWorkers.Quartz/Volo/Abp/BackgroundWorkers/Quartz/QuartzBackgroundWorkerManager.cs new file mode 100644 index 0000000000..a89245d0b2 --- /dev/null +++ b/framework/src/Volo.Abp.BackgroundWorkers.Quartz/Volo/Abp/BackgroundWorkers/Quartz/QuartzBackgroundWorkerManager.cs @@ -0,0 +1,41 @@ +using System.Threading; +using System.Threading.Tasks; +using Quartz; +using Volo.Abp.DependencyInjection; +using Volo.Abp.Threading; + +namespace Volo.Abp.BackgroundWorkers.Quartz +{ + public class QuartzBackgroundWorkerManager : IBackgroundWorkerManager, ITransientDependency + { + private readonly IScheduler _scheduler; + + public QuartzBackgroundWorkerManager(IScheduler scheduler) + { + _scheduler = scheduler; + } + + public async Task StartAsync(CancellationToken cancellationToken = default) + { + await _scheduler.ResumeAll(cancellationToken); + } + + public async Task StopAsync(CancellationToken cancellationToken = default) + { + if (!_scheduler.IsShutdown) + { + await _scheduler.PauseAll(cancellationToken); + } + + } + + public void Add(IBackgroundWorker worker) + { + if (worker is IQuartzBackgroundWorker quartzWork) + { + AsyncHelper.RunSync(() => _scheduler.ScheduleJob(quartzWork.JobDetail, quartzWork.Trigger)); + } + } + + } +} diff --git a/framework/src/Volo.Abp.Quartz/FodyWeavers.xml b/framework/src/Volo.Abp.Quartz/FodyWeavers.xml new file mode 100644 index 0000000000..be0de3a908 --- /dev/null +++ b/framework/src/Volo.Abp.Quartz/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/framework/src/Volo.Abp.Quartz/FodyWeavers.xsd b/framework/src/Volo.Abp.Quartz/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/framework/src/Volo.Abp.Quartz/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/framework/src/Volo.Abp.Quartz/Microsoft/Extensions/DependencyInjection/AbpQuartzServiceCollectionExtensions.cs b/framework/src/Volo.Abp.Quartz/Microsoft/Extensions/DependencyInjection/AbpQuartzServiceCollectionExtensions.cs new file mode 100644 index 0000000000..20597fc94e --- /dev/null +++ b/framework/src/Volo.Abp.Quartz/Microsoft/Extensions/DependencyInjection/AbpQuartzServiceCollectionExtensions.cs @@ -0,0 +1,16 @@ +using Quartz.Impl; +using Quartz.Spi; +using Volo.Abp.Quartz; +using Volo.Abp.Threading; + +namespace Microsoft.Extensions.DependencyInjection +{ + public static class AbpQuartzServiceCollectionExtensions + { + public static IServiceCollection AddQuartz(this IServiceCollection services, AbpQuartzPreOptions options) + { + services.AddSingleton(AsyncHelper.RunSync(() => new StdSchedulerFactory(options.Properties).GetScheduler())); + return services.AddSingleton(typeof(IJobFactory), typeof(AbpQuartzJobFactory)); + } + } +} diff --git a/framework/src/Volo.Abp.Quartz/Volo.Abp.Quartz.csproj b/framework/src/Volo.Abp.Quartz/Volo.Abp.Quartz.csproj new file mode 100644 index 0000000000..8e29b1f803 --- /dev/null +++ b/framework/src/Volo.Abp.Quartz/Volo.Abp.Quartz.csproj @@ -0,0 +1,25 @@ + + + + + + + netstandard2.0 + Volo.Abp.Quartz + Volo.Abp.Quartz + $(AssetTargetFallback);portable-net45+win8+wp8+wpa81; + false + false + false + + + + + + + + + + + + diff --git a/framework/src/Volo.Abp.Quartz/Volo/Abp/Quartz/AbpQuartzJobFactory.cs b/framework/src/Volo.Abp.Quartz/Volo/Abp/Quartz/AbpQuartzJobFactory.cs new file mode 100644 index 0000000000..8e738b9bb8 --- /dev/null +++ b/framework/src/Volo.Abp.Quartz/Volo/Abp/Quartz/AbpQuartzJobFactory.cs @@ -0,0 +1,26 @@ +using System; +using Microsoft.Extensions.DependencyInjection; +using Quartz; +using Quartz.Spi; + +namespace Volo.Abp.Quartz +{ + public class AbpQuartzJobFactory : IJobFactory + { + private readonly IServiceProvider _serviceProvider; + public AbpQuartzJobFactory(IServiceProvider serviceProvider) + { + _serviceProvider = serviceProvider; + } + + public IJob NewJob(TriggerFiredBundle bundle, IScheduler scheduler) + { + return _serviceProvider.GetRequiredService(bundle.JobDetail.JobType) as IJob; + } + + public void ReturnJob(IJob job) + { + (job as IDisposable)?.Dispose(); + } + } +} diff --git a/framework/src/Volo.Abp.Quartz/Volo/Abp/Quartz/AbpQuartzModule.cs b/framework/src/Volo.Abp.Quartz/Volo/Abp/Quartz/AbpQuartzModule.cs new file mode 100644 index 0000000000..e1ae376a12 --- /dev/null +++ b/framework/src/Volo.Abp.Quartz/Volo/Abp/Quartz/AbpQuartzModule.cs @@ -0,0 +1,32 @@ +using Microsoft.Extensions.DependencyInjection; +using Quartz; +using Quartz.Spi; +using Volo.Abp.Modularity; + +namespace Volo.Abp.Quartz +{ + public class AbpQuartzModule : AbpModule + { + + private IScheduler _scheduler; + + public override void ConfigureServices(ServiceConfigurationContext context) + { + var options = context.Services.ExecutePreConfiguredActions(); + context.Services.AddQuartz(options); + } + + public override void OnApplicationInitialization(ApplicationInitializationContext context) + { + _scheduler = context.ServiceProvider.GetService(); + _scheduler.JobFactory = context.ServiceProvider.GetService(); + _scheduler.Start(); + } + + public override void OnApplicationShutdown(ApplicationShutdownContext context) + { + //TODO: ABP may provide two methods for application shutdown: OnPreApplicationShutdown & OnApplicationShutdown + _scheduler.Shutdown(); + } + } +} diff --git a/framework/src/Volo.Abp.Quartz/Volo/Abp/Quartz/AbpQuartzPreOptions.cs b/framework/src/Volo.Abp.Quartz/Volo/Abp/Quartz/AbpQuartzPreOptions.cs new file mode 100644 index 0000000000..cfab842a28 --- /dev/null +++ b/framework/src/Volo.Abp.Quartz/Volo/Abp/Quartz/AbpQuartzPreOptions.cs @@ -0,0 +1,10 @@ +using System.Collections.Specialized; +using JetBrains.Annotations; + +namespace Volo.Abp.Quartz +{ + public class AbpQuartzPreOptions + { + public NameValueCollection Properties => new NameValueCollection(); + } +} From 724ab7ba863e92b3fa80e1960d2d2911c7662d58 Mon Sep 17 00:00:00 2001 From: liangshiwei Date: Sun, 23 Feb 2020 20:42:21 +0800 Subject: [PATCH 08/56] Check that the parameter is null --- .../Quartz/QuartzBackgroundWorkerManager.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/framework/src/Volo.Abp.BackgroundWorkers.Quartz/Volo/Abp/BackgroundWorkers/Quartz/QuartzBackgroundWorkerManager.cs b/framework/src/Volo.Abp.BackgroundWorkers.Quartz/Volo/Abp/BackgroundWorkers/Quartz/QuartzBackgroundWorkerManager.cs index a89245d0b2..beaa049f5a 100644 --- a/framework/src/Volo.Abp.BackgroundWorkers.Quartz/Volo/Abp/BackgroundWorkers/Quartz/QuartzBackgroundWorkerManager.cs +++ b/framework/src/Volo.Abp.BackgroundWorkers.Quartz/Volo/Abp/BackgroundWorkers/Quartz/QuartzBackgroundWorkerManager.cs @@ -1,4 +1,5 @@ -using System.Threading; +using System; +using System.Threading; using System.Threading.Tasks; using Quartz; using Volo.Abp.DependencyInjection; @@ -26,13 +27,16 @@ namespace Volo.Abp.BackgroundWorkers.Quartz { await _scheduler.PauseAll(cancellationToken); } - + } public void Add(IBackgroundWorker worker) { if (worker is IQuartzBackgroundWorker quartzWork) { + Check.NotNull(quartzWork.Trigger, nameof(quartzWork.Trigger)); + Check.NotNull(quartzWork.JobDetail, nameof(quartzWork.JobDetail)); + AsyncHelper.RunSync(() => _scheduler.ScheduleJob(quartzWork.JobDetail, quartzWork.Trigger)); } } From 595a44fa9406283fa09795d0cb316bc02983efe6 Mon Sep 17 00:00:00 2001 From: liangshiwei Date: Mon, 24 Feb 2020 18:04:19 +0800 Subject: [PATCH 09/56] Code formatting --- .../Quartz/QuartzBackgroundJobManager.cs | 2 -- .../Quartz/QuartzJobExecutionAdapter.cs | 3 +-- .../FodyWeavers.xml | 2 +- .../Quartz/AbpBackgroundWorkersQuartzModule.cs | 5 +---- .../Quartz/QuartzBackgroundWorkerBase.cs | 2 -- .../Quartz/QuartzBackgroundWorkerManager.cs | 5 +---- .../AbpQuartzServiceCollectionExtensions.cs | 16 ---------------- .../Volo/Abp/Quartz/AbpQuartzJobFactory.cs | 1 + .../Volo/Abp/Quartz/AbpQuartzModule.cs | 6 ++++-- .../Volo/Abp/Quartz/AbpQuartzPreOptions.cs | 1 - 10 files changed, 9 insertions(+), 34 deletions(-) delete mode 100644 framework/src/Volo.Abp.Quartz/Microsoft/Extensions/DependencyInjection/AbpQuartzServiceCollectionExtensions.cs diff --git a/framework/src/Volo.Abp.BackgroundJobs.Quartz/Volo/Abp/BackgroundJobs/Quartz/QuartzBackgroundJobManager.cs b/framework/src/Volo.Abp.BackgroundJobs.Quartz/Volo/Abp/BackgroundJobs/Quartz/QuartzBackgroundJobManager.cs index ebc1e747d0..2e7b8193b4 100644 --- a/framework/src/Volo.Abp.BackgroundJobs.Quartz/Volo/Abp/BackgroundJobs/Quartz/QuartzBackgroundJobManager.cs +++ b/framework/src/Volo.Abp.BackgroundJobs.Quartz/Volo/Abp/BackgroundJobs/Quartz/QuartzBackgroundJobManager.cs @@ -20,9 +20,7 @@ namespace Volo.Abp.BackgroundJobs.Quartz { var jobDetail = JobBuilder.Create>().SetJobData(new JobDataMap { { nameof(TArgs), args } }).Build(); var trigger = !delay.HasValue ? TriggerBuilder.Create().StartNow().Build() : TriggerBuilder.Create().StartAt(new DateTimeOffset(DateTime.Now.Add(delay.Value))).Build(); - await _scheduler.ScheduleJob(jobDetail, trigger); - return jobDetail.Key.ToString(); } } diff --git a/framework/src/Volo.Abp.BackgroundJobs.Quartz/Volo/Abp/BackgroundJobs/Quartz/QuartzJobExecutionAdapter.cs b/framework/src/Volo.Abp.BackgroundJobs.Quartz/Volo/Abp/BackgroundJobs/Quartz/QuartzJobExecutionAdapter.cs index 614c09af2c..59a0223465 100644 --- a/framework/src/Volo.Abp.BackgroundJobs.Quartz/Volo/Abp/BackgroundJobs/Quartz/QuartzJobExecutionAdapter.cs +++ b/framework/src/Volo.Abp.BackgroundJobs.Quartz/Volo/Abp/BackgroundJobs/Quartz/QuartzJobExecutionAdapter.cs @@ -11,7 +11,7 @@ namespace Volo.Abp.BackgroundJobs.Quartz protected AbpBackgroundJobOptions Options { get; } protected IServiceScopeFactory ServiceScopeFactory { get; } protected IBackgroundJobExecuter JobExecuter { get; } - + public QuartzJobExecutionAdapter( IOptions options, IBackgroundJobExecuter jobExecuter, @@ -22,7 +22,6 @@ namespace Volo.Abp.BackgroundJobs.Quartz Options = options.Value; } - public async Task Execute(IJobExecutionContext context) { using (var scope = ServiceScopeFactory.CreateScope()) diff --git a/framework/src/Volo.Abp.BackgroundWorkers.Quartz/FodyWeavers.xml b/framework/src/Volo.Abp.BackgroundWorkers.Quartz/FodyWeavers.xml index 00e1d9a1c1..be0de3a908 100644 --- a/framework/src/Volo.Abp.BackgroundWorkers.Quartz/FodyWeavers.xml +++ b/framework/src/Volo.Abp.BackgroundWorkers.Quartz/FodyWeavers.xml @@ -1,3 +1,3 @@  - + \ No newline at end of file diff --git a/framework/src/Volo.Abp.BackgroundWorkers.Quartz/Volo/Abp/BackgroundWorkers/Quartz/AbpBackgroundWorkersQuartzModule.cs b/framework/src/Volo.Abp.BackgroundWorkers.Quartz/Volo/Abp/BackgroundWorkers/Quartz/AbpBackgroundWorkersQuartzModule.cs index 37f9329b10..bf7e091e7b 100644 --- a/framework/src/Volo.Abp.BackgroundWorkers.Quartz/Volo/Abp/BackgroundWorkers/Quartz/AbpBackgroundWorkersQuartzModule.cs +++ b/framework/src/Volo.Abp.BackgroundWorkers.Quartz/Volo/Abp/BackgroundWorkers/Quartz/AbpBackgroundWorkersQuartzModule.cs @@ -14,12 +14,9 @@ namespace Volo.Abp.BackgroundWorkers.Quartz public override void PreConfigureServices(ServiceConfigurationContext context) { context.Services.AddConventionalRegistrar(new AbpQuartzConventionalRegistrar()); - context.Services.Replace(ServiceDescriptor - .Transient()); - + context.Services.Replace(ServiceDescriptor.Transient()); } - public override void OnApplicationInitialization(ApplicationInitializationContext context) { using (var scope = context.ServiceProvider.CreateScope()) diff --git a/framework/src/Volo.Abp.BackgroundWorkers.Quartz/Volo/Abp/BackgroundWorkers/Quartz/QuartzBackgroundWorkerBase.cs b/framework/src/Volo.Abp.BackgroundWorkers.Quartz/Volo/Abp/BackgroundWorkers/Quartz/QuartzBackgroundWorkerBase.cs index a72d75b840..4b18b9424e 100644 --- a/framework/src/Volo.Abp.BackgroundWorkers.Quartz/Volo/Abp/BackgroundWorkers/Quartz/QuartzBackgroundWorkerBase.cs +++ b/framework/src/Volo.Abp.BackgroundWorkers.Quartz/Volo/Abp/BackgroundWorkers/Quartz/QuartzBackgroundWorkerBase.cs @@ -7,8 +7,6 @@ namespace Volo.Abp.BackgroundWorkers.Quartz { public ITrigger Trigger { get; set; } public IJobDetail JobDetail { get; set; } - - public abstract Task Execute(IJobExecutionContext context); } diff --git a/framework/src/Volo.Abp.BackgroundWorkers.Quartz/Volo/Abp/BackgroundWorkers/Quartz/QuartzBackgroundWorkerManager.cs b/framework/src/Volo.Abp.BackgroundWorkers.Quartz/Volo/Abp/BackgroundWorkers/Quartz/QuartzBackgroundWorkerManager.cs index beaa049f5a..3fbdfd7ba7 100644 --- a/framework/src/Volo.Abp.BackgroundWorkers.Quartz/Volo/Abp/BackgroundWorkers/Quartz/QuartzBackgroundWorkerManager.cs +++ b/framework/src/Volo.Abp.BackgroundWorkers.Quartz/Volo/Abp/BackgroundWorkers/Quartz/QuartzBackgroundWorkerManager.cs @@ -1,5 +1,4 @@ -using System; -using System.Threading; +using System.Threading; using System.Threading.Tasks; using Quartz; using Volo.Abp.DependencyInjection; @@ -27,7 +26,6 @@ namespace Volo.Abp.BackgroundWorkers.Quartz { await _scheduler.PauseAll(cancellationToken); } - } public void Add(IBackgroundWorker worker) @@ -40,6 +38,5 @@ namespace Volo.Abp.BackgroundWorkers.Quartz AsyncHelper.RunSync(() => _scheduler.ScheduleJob(quartzWork.JobDetail, quartzWork.Trigger)); } } - } } diff --git a/framework/src/Volo.Abp.Quartz/Microsoft/Extensions/DependencyInjection/AbpQuartzServiceCollectionExtensions.cs b/framework/src/Volo.Abp.Quartz/Microsoft/Extensions/DependencyInjection/AbpQuartzServiceCollectionExtensions.cs deleted file mode 100644 index 20597fc94e..0000000000 --- a/framework/src/Volo.Abp.Quartz/Microsoft/Extensions/DependencyInjection/AbpQuartzServiceCollectionExtensions.cs +++ /dev/null @@ -1,16 +0,0 @@ -using Quartz.Impl; -using Quartz.Spi; -using Volo.Abp.Quartz; -using Volo.Abp.Threading; - -namespace Microsoft.Extensions.DependencyInjection -{ - public static class AbpQuartzServiceCollectionExtensions - { - public static IServiceCollection AddQuartz(this IServiceCollection services, AbpQuartzPreOptions options) - { - services.AddSingleton(AsyncHelper.RunSync(() => new StdSchedulerFactory(options.Properties).GetScheduler())); - return services.AddSingleton(typeof(IJobFactory), typeof(AbpQuartzJobFactory)); - } - } -} diff --git a/framework/src/Volo.Abp.Quartz/Volo/Abp/Quartz/AbpQuartzJobFactory.cs b/framework/src/Volo.Abp.Quartz/Volo/Abp/Quartz/AbpQuartzJobFactory.cs index 8e738b9bb8..808ee06e94 100644 --- a/framework/src/Volo.Abp.Quartz/Volo/Abp/Quartz/AbpQuartzJobFactory.cs +++ b/framework/src/Volo.Abp.Quartz/Volo/Abp/Quartz/AbpQuartzJobFactory.cs @@ -8,6 +8,7 @@ namespace Volo.Abp.Quartz public class AbpQuartzJobFactory : IJobFactory { private readonly IServiceProvider _serviceProvider; + public AbpQuartzJobFactory(IServiceProvider serviceProvider) { _serviceProvider = serviceProvider; diff --git a/framework/src/Volo.Abp.Quartz/Volo/Abp/Quartz/AbpQuartzModule.cs b/framework/src/Volo.Abp.Quartz/Volo/Abp/Quartz/AbpQuartzModule.cs index e1ae376a12..c16ab14f4d 100644 --- a/framework/src/Volo.Abp.Quartz/Volo/Abp/Quartz/AbpQuartzModule.cs +++ b/framework/src/Volo.Abp.Quartz/Volo/Abp/Quartz/AbpQuartzModule.cs @@ -1,19 +1,21 @@ using Microsoft.Extensions.DependencyInjection; using Quartz; +using Quartz.Impl; using Quartz.Spi; using Volo.Abp.Modularity; +using Volo.Abp.Threading; namespace Volo.Abp.Quartz { public class AbpQuartzModule : AbpModule { - private IScheduler _scheduler; public override void ConfigureServices(ServiceConfigurationContext context) { var options = context.Services.ExecutePreConfiguredActions(); - context.Services.AddQuartz(options); + context.Services.AddSingleton(AsyncHelper.RunSync(() => new StdSchedulerFactory(options.Properties).GetScheduler())); + context.Services.AddSingleton(typeof(IJobFactory), typeof(AbpQuartzJobFactory)); } public override void OnApplicationInitialization(ApplicationInitializationContext context) diff --git a/framework/src/Volo.Abp.Quartz/Volo/Abp/Quartz/AbpQuartzPreOptions.cs b/framework/src/Volo.Abp.Quartz/Volo/Abp/Quartz/AbpQuartzPreOptions.cs index cfab842a28..0c60ee13be 100644 --- a/framework/src/Volo.Abp.Quartz/Volo/Abp/Quartz/AbpQuartzPreOptions.cs +++ b/framework/src/Volo.Abp.Quartz/Volo/Abp/Quartz/AbpQuartzPreOptions.cs @@ -1,5 +1,4 @@ using System.Collections.Specialized; -using JetBrains.Annotations; namespace Volo.Abp.Quartz { From 37f0f3e9324f184e1f5769a3678a7c868a132b87 Mon Sep 17 00:00:00 2001 From: Galip Tolga Erdem Date: Mon, 24 Feb 2020 17:33:23 +0300 Subject: [PATCH 10/56] Fixed error when expected UserId is string but not guid --- .../Security/Principal/AbpClaimsIdentityExtensions.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/framework/src/Volo.Abp.Security/System/Security/Principal/AbpClaimsIdentityExtensions.cs b/framework/src/Volo.Abp.Security/System/Security/Principal/AbpClaimsIdentityExtensions.cs index 694fb7baa6..f4e4bba1a0 100644 --- a/framework/src/Volo.Abp.Security/System/Security/Principal/AbpClaimsIdentityExtensions.cs +++ b/framework/src/Volo.Abp.Security/System/Security/Principal/AbpClaimsIdentityExtensions.cs @@ -17,8 +17,11 @@ namespace System.Security.Principal { return null; } - - return Guid.Parse(userIdOrNull.Value); + if (Guid.TryParse(userIdOrNull.Value, out Guid result)) + { + return result; + } + return null; } public static Guid? FindUserId([NotNull] this IIdentity identity) From f076666d178e1925004a5f7f8735de98aac2b195 Mon Sep 17 00:00:00 2001 From: AkinCam <172804016@ogr.cbu.edu.tr> Date: Tue, 25 Feb 2020 01:14:30 +0300 Subject: [PATCH 11/56] Added orderedpost list methot --- .../Volo/Blogging/Posts/IPostAppService.cs | 2 ++ .../Volo/Blogging/Posts/PostAppService.cs | 12 ++++++++++++ .../Volo/Blogging/Blogs/BlogConsts.cs | 1 + .../Volo/Blogging/PostsController.cs | 8 ++++++++ 4 files changed, 23 insertions(+) diff --git a/modules/blogging/src/Volo.Blogging.Application.Contracts/Volo/Blogging/Posts/IPostAppService.cs b/modules/blogging/src/Volo.Blogging.Application.Contracts/Volo/Blogging/Posts/IPostAppService.cs index aee0a26a23..f53c144d31 100644 --- a/modules/blogging/src/Volo.Blogging.Application.Contracts/Volo/Blogging/Posts/IPostAppService.cs +++ b/modules/blogging/src/Volo.Blogging.Application.Contracts/Volo/Blogging/Posts/IPostAppService.cs @@ -9,6 +9,8 @@ namespace Volo.Blogging.Posts { Task> GetListByBlogIdAndTagName(Guid blogId, string tagName); + Task> GetListSortedPostsByTime(); + Task GetForReadingAsync(GetPostInput input); Task GetAsync(Guid id); diff --git a/modules/blogging/src/Volo.Blogging.Application/Volo/Blogging/Posts/PostAppService.cs b/modules/blogging/src/Volo.Blogging.Application/Volo/Blogging/Posts/PostAppService.cs index d798814caa..a23309a33a 100644 --- a/modules/blogging/src/Volo.Blogging.Application/Volo/Blogging/Posts/PostAppService.cs +++ b/modules/blogging/src/Volo.Blogging.Application/Volo/Blogging/Posts/PostAppService.cs @@ -68,7 +68,19 @@ namespace Volo.Blogging.Posts } } } + + return new ListResultDto(postDtos); + } + + public async Task> GetOrderedListPostsByTime() + { + var posts = (await _postRepository.GetListAsync()).OrderByDescending(x => x.CreationTime).ToList(); + var postDtos = new List(ObjectMapper.Map, List>(posts)); + foreach (var postDto in postDtos) + { + postDto.Tags = await GetTagsOfPost(postDto.Id); + } return new ListResultDto(postDtos); } diff --git a/modules/blogging/src/Volo.Blogging.Domain.Shared/Volo/Blogging/Blogs/BlogConsts.cs b/modules/blogging/src/Volo.Blogging.Domain.Shared/Volo/Blogging/Blogs/BlogConsts.cs index 502a4364e7..b9613b5a4e 100644 --- a/modules/blogging/src/Volo.Blogging.Domain.Shared/Volo/Blogging/Blogs/BlogConsts.cs +++ b/modules/blogging/src/Volo.Blogging.Domain.Shared/Volo/Blogging/Blogs/BlogConsts.cs @@ -7,5 +7,6 @@ public const int MaxShortNameLength = 32; public const int MaxDescriptionLength = 1024; + } } diff --git a/modules/blogging/src/Volo.Blogging.HttpApi/Volo/Blogging/PostsController.cs b/modules/blogging/src/Volo.Blogging.HttpApi/Volo/Blogging/PostsController.cs index 79e7d920f8..1b465f83c2 100644 --- a/modules/blogging/src/Volo.Blogging.HttpApi/Volo/Blogging/PostsController.cs +++ b/modules/blogging/src/Volo.Blogging.HttpApi/Volo/Blogging/PostsController.cs @@ -27,6 +27,13 @@ namespace Volo.Blogging return _postAppService.GetListByBlogIdAndTagName(blogId, tagName); } + + [HttpGet] + public Task> GetOrderedListPostsByTime() + { + return _postAppService.GetOrderedListPostsByTime(); + } + [HttpGet] [Route("read")] public Task GetForReadingAsync(GetPostInput input) @@ -60,5 +67,6 @@ namespace Volo.Blogging { return _postAppService.DeleteAsync(id); } + } } From d47460c412d0aea82c981c96781408d3baf7460c Mon Sep 17 00:00:00 2001 From: AkinCam <172804016@ogr.cbu.edu.tr> Date: Tue, 25 Feb 2020 01:18:32 +0300 Subject: [PATCH 12/56] modified methot name --- .../Volo/Blogging/Posts/IPostAppService.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/blogging/src/Volo.Blogging.Application.Contracts/Volo/Blogging/Posts/IPostAppService.cs b/modules/blogging/src/Volo.Blogging.Application.Contracts/Volo/Blogging/Posts/IPostAppService.cs index f53c144d31..c16a8903e8 100644 --- a/modules/blogging/src/Volo.Blogging.Application.Contracts/Volo/Blogging/Posts/IPostAppService.cs +++ b/modules/blogging/src/Volo.Blogging.Application.Contracts/Volo/Blogging/Posts/IPostAppService.cs @@ -9,7 +9,7 @@ namespace Volo.Blogging.Posts { Task> GetListByBlogIdAndTagName(Guid blogId, string tagName); - Task> GetListSortedPostsByTime(); + Task> GetOrderedListPostsByTime(); Task GetForReadingAsync(GetPostInput input); From 5fcf2659be6f5c253b9367af620045c1612ae654 Mon Sep 17 00:00:00 2001 From: maliming Date: Tue, 25 Feb 2020 11:15:09 +0800 Subject: [PATCH 13/56] Make AbpResourceOwnerPasswordValidator return detailed reason. --- .../IdentityServer/Localization/Resources/en.json | 6 +++++- .../IdentityServer/Localization/Resources/tr.json | 6 +++++- .../Localization/Resources/zh-Hans.json | 6 +++++- .../Localization/Resources/zh-Hant.json | 6 +++++- .../AbpResourceOwnerPasswordValidator.cs | 15 ++++++++++++--- 5 files changed, 32 insertions(+), 7 deletions(-) diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/Localization/Resources/en.json b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/Localization/Resources/en.json index 6b2757a963..f974297b06 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/Localization/Resources/en.json +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/Localization/Resources/en.json @@ -3,6 +3,10 @@ "texts": { "Volo.IdentityServer:DuplicateIdentityResourceName": "Identity Resource name already exist: {Name}", "Volo.IdentityServer:DuplicateApiResourceName": "Api Resource name already exist: {Name}", - "Volo.IdentityServer:DuplicateClientId": "ClientId already exist: {ClientId}" + "Volo.IdentityServer:DuplicateClientId": "ClientId already exist: {ClientId}", + "UserLockedOut": "The user account has been locked out due to invalid login attempts. Please wait a while and try again.", + "InvalidUserNameOrPassword": "Invalid username or password!", + "LoginIsNotAllowed": "You are not allowed to login! You need to confirm your email/phone number.", + "InvalidUsername": "Invalid username or password!" } } \ No newline at end of file diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/Localization/Resources/tr.json b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/Localization/Resources/tr.json index 9340b7999f..60f7a75a77 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/Localization/Resources/tr.json +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/Localization/Resources/tr.json @@ -3,6 +3,10 @@ "texts": { "Volo.IdentityServer:DuplicateIdentityResourceName": "Identity Resource adı zaten mevcut: {Name}", "Volo.IdentityServer:DuplicateApiResourceName": "Api Resource adı zaten mevcut: {Name}", - "Volo.IdentityServer:DuplicateClientId": "ClientId already zaten mevcut: {ClientId}" + "Volo.IdentityServer:DuplicateClientId": "ClientId already zaten mevcut: {ClientId}", + "UserLockedOut": "Kullanıcı hesabı hatalı giriş denemeleri nedeniyle kilitlenmiştir. Lütfen bir süre bekleyip tekrar deneyin.", + "InvalidUserNameOrPassword": "Kullanıcı adı ya da şifre geçersiz!", + "LoginIsNotAllowed": "Giriş yapamazsınız! E-posta adresinizi ya da telefon numaranızı doğrulamanız gerekiyor.", + "InvalidUsername": "Kullanıcı adı ya da şifre geçersiz!" } } \ No newline at end of file diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/Localization/Resources/zh-Hans.json b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/Localization/Resources/zh-Hans.json index b2d186e8b4..ac175e574d 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/Localization/Resources/zh-Hans.json +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/Localization/Resources/zh-Hans.json @@ -3,6 +3,10 @@ "texts": { "Volo.IdentityServer:DuplicateIdentityResourceName": "Identity资源名称已存在: {Name}", "Volo.IdentityServer:DuplicateApiResourceName": "Api资源名称已存在: {Name}", - "Volo.IdentityServer:DuplicateClientId": "ClientId已经存在: {ClientId}" + "Volo.IdentityServer:DuplicateClientId": "ClientId已经存在: {ClientId}", + "UserLockedOut": "登录失败,用户账户已被锁定.请稍后再试.", + "InvalidUserNameOrPassword": "用户名或密码错误!", + "LoginIsNotAllowed": "无法登录!你需要验证邮箱地址/手机号.", + "InvalidUsername": "用户名或密码错误!" } } \ No newline at end of file diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/Localization/Resources/zh-Hant.json b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/Localization/Resources/zh-Hant.json index 859e8c29b7..0ffeae8f81 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/Localization/Resources/zh-Hant.json +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/Localization/Resources/zh-Hant.json @@ -3,6 +3,10 @@ "texts": { "Volo.IdentityServer:DuplicateIdentityResourceName": "Identity資源名稱已存在: {Name}", "Volo.IdentityServer:DuplicateApiResourceName": "Api資源名稱已存在: {Name}", - "Volo.IdentityServer:DuplicateClientId": "ClientId已經存在: {ClientId}" + "Volo.IdentityServer:DuplicateClientId": "ClientId已經存在: {ClientId}", + "UserLockedOut": "登錄失敗,用戶賬戶已被鎖定.請稍後再試.", + "InvalidUserNameOrPassword": "用戶名或密碼錯誤!", + "LoginIsNotAllowed": "無法登錄!妳需要驗證郵箱地址/手機號.", + "InvalidUsername": "用戶名或密碼錯誤!" } } \ No newline at end of file diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/AspNetIdentity/AbpResourceOwnerPasswordValidator.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/AspNetIdentity/AbpResourceOwnerPasswordValidator.cs index 68489a1bdb..ce11a167e1 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/AspNetIdentity/AbpResourceOwnerPasswordValidator.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/AspNetIdentity/AbpResourceOwnerPasswordValidator.cs @@ -8,7 +8,9 @@ using IdentityServer4.Models; using IdentityServer4.Services; using IdentityServer4.Validation; using Microsoft.AspNetCore.Identity; +using Microsoft.Extensions.Localization; using Microsoft.Extensions.Logging; +using Volo.Abp.IdentityServer.Localization; using Volo.Abp.Security.Claims; using Volo.Abp.Uow; using Volo.Abp.Validation; @@ -22,17 +24,20 @@ namespace Volo.Abp.IdentityServer.AspNetIdentity private readonly IEventService _events; private readonly UserManager _userManager; private readonly ILogger> _logger; + private readonly IStringLocalizer _localizer; public AbpResourceOwnerPasswordValidator( UserManager userManager, SignInManager signInManager, IEventService events, - ILogger> logger) + ILogger> logger, + IStringLocalizer localizer) { _userManager = userManager; _signInManager = signInManager; _events = events; _logger = logger; + _localizer = localizer; } /// @@ -44,8 +49,8 @@ namespace Volo.Abp.IdentityServer.AspNetIdentity public virtual async Task ValidateAsync(ResourceOwnerPasswordValidationContext context) { await ReplaceEmailToUsernameOfInputIfNeeds(context); - var user = await _userManager.FindByNameAsync(context.UserName); + string errorDescription; if (user != null) { var result = await _signInManager.CheckPasswordSignInAsync(user, context.Password, true); @@ -72,25 +77,29 @@ namespace Volo.Abp.IdentityServer.AspNetIdentity { _logger.LogInformation("Authentication failed for username: {username}, reason: locked out", context.UserName); await _events.RaiseAsync(new UserLoginFailureEvent(context.UserName, "locked out", interactive: false)); + errorDescription = _localizer["UserLockedOut"]; } else if (result.IsNotAllowed) { _logger.LogInformation("Authentication failed for username: {username}, reason: not allowed", context.UserName); await _events.RaiseAsync(new UserLoginFailureEvent(context.UserName, "not allowed", interactive: false)); + errorDescription = _localizer["LoginIsNotAllowed"]; } else { _logger.LogInformation("Authentication failed for username: {username}, reason: invalid credentials", context.UserName); await _events.RaiseAsync(new UserLoginFailureEvent(context.UserName, "invalid credentials", interactive: false)); + errorDescription = _localizer["InvalidUserNameOrPassword"]; } } else { _logger.LogInformation("No user found matching username: {username}", context.UserName); await _events.RaiseAsync(new UserLoginFailureEvent(context.UserName, "invalid username", interactive: false)); + errorDescription = _localizer["InvalidUsername"]; } - context.Result = new GrantValidationResult(TokenRequestErrors.InvalidGrant); + context.Result = new GrantValidationResult(TokenRequestErrors.InvalidGrant, errorDescription); } protected virtual async Task ReplaceEmailToUsernameOfInputIfNeeds(ResourceOwnerPasswordValidationContext context) From 7af6ede0a7d9fd4a99fe66cdb141f9e232acb1b0 Mon Sep 17 00:00:00 2001 From: liangshiwei Date: Tue, 25 Feb 2020 13:08:41 +0800 Subject: [PATCH 14/56] Code formatting --- .../Abp/BackgroundWorkers/Quartz/IQuartzBackgroundWorker.cs | 1 + .../Abp/BackgroundWorkers/Quartz/QuartzBackgroundWorkerBase.cs | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/framework/src/Volo.Abp.BackgroundWorkers.Quartz/Volo/Abp/BackgroundWorkers/Quartz/IQuartzBackgroundWorker.cs b/framework/src/Volo.Abp.BackgroundWorkers.Quartz/Volo/Abp/BackgroundWorkers/Quartz/IQuartzBackgroundWorker.cs index 740b6de441..ffc2117e6f 100644 --- a/framework/src/Volo.Abp.BackgroundWorkers.Quartz/Volo/Abp/BackgroundWorkers/Quartz/IQuartzBackgroundWorker.cs +++ b/framework/src/Volo.Abp.BackgroundWorkers.Quartz/Volo/Abp/BackgroundWorkers/Quartz/IQuartzBackgroundWorker.cs @@ -5,6 +5,7 @@ namespace Volo.Abp.BackgroundWorkers.Quartz public interface IQuartzBackgroundWorker : IBackgroundWorker, IJob { ITrigger Trigger { get; set; } + IJobDetail JobDetail { get; set; } } } diff --git a/framework/src/Volo.Abp.BackgroundWorkers.Quartz/Volo/Abp/BackgroundWorkers/Quartz/QuartzBackgroundWorkerBase.cs b/framework/src/Volo.Abp.BackgroundWorkers.Quartz/Volo/Abp/BackgroundWorkers/Quartz/QuartzBackgroundWorkerBase.cs index 4b18b9424e..e468ac80f5 100644 --- a/framework/src/Volo.Abp.BackgroundWorkers.Quartz/Volo/Abp/BackgroundWorkers/Quartz/QuartzBackgroundWorkerBase.cs +++ b/framework/src/Volo.Abp.BackgroundWorkers.Quartz/Volo/Abp/BackgroundWorkers/Quartz/QuartzBackgroundWorkerBase.cs @@ -6,8 +6,9 @@ namespace Volo.Abp.BackgroundWorkers.Quartz public abstract class QuartzBackgroundWorkerBase : BackgroundWorkerBase, IQuartzBackgroundWorker { public ITrigger Trigger { get; set; } + public IJobDetail JobDetail { get; set; } - public abstract Task Execute(IJobExecutionContext context); + public abstract Task Execute(IJobExecutionContext context); } } From df43685307d0a0e2e05b44f47612518d038e0a24 Mon Sep 17 00:00:00 2001 From: liangshiwei Date: Tue, 25 Feb 2020 14:25:10 +0800 Subject: [PATCH 15/56] Release the scope instance in jobfactory --- .../Quartz/QuartzJobExecutionAdapter.cs | 6 +++--- .../Volo/Abp/Quartz/AbpQuartzJobFactory.cs | 18 ++++++++++++++++-- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/framework/src/Volo.Abp.BackgroundJobs.Quartz/Volo/Abp/BackgroundJobs/Quartz/QuartzJobExecutionAdapter.cs b/framework/src/Volo.Abp.BackgroundJobs.Quartz/Volo/Abp/BackgroundJobs/Quartz/QuartzJobExecutionAdapter.cs index 59a0223465..85a1ef736f 100644 --- a/framework/src/Volo.Abp.BackgroundJobs.Quartz/Volo/Abp/BackgroundJobs/Quartz/QuartzJobExecutionAdapter.cs +++ b/framework/src/Volo.Abp.BackgroundJobs.Quartz/Volo/Abp/BackgroundJobs/Quartz/QuartzJobExecutionAdapter.cs @@ -1,12 +1,12 @@ -using System.Threading.Tasks; +using System; +using System.Threading.Tasks; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Options; using Quartz; -using Volo.Abp.DependencyInjection; namespace Volo.Abp.BackgroundJobs.Quartz { - public class QuartzJobExecutionAdapter : IJob, ITransientDependency + public class QuartzJobExecutionAdapter : IJob { protected AbpBackgroundJobOptions Options { get; } protected IServiceScopeFactory ServiceScopeFactory { get; } diff --git a/framework/src/Volo.Abp.Quartz/Volo/Abp/Quartz/AbpQuartzJobFactory.cs b/framework/src/Volo.Abp.Quartz/Volo/Abp/Quartz/AbpQuartzJobFactory.cs index 808ee06e94..428dbe03af 100644 --- a/framework/src/Volo.Abp.Quartz/Volo/Abp/Quartz/AbpQuartzJobFactory.cs +++ b/framework/src/Volo.Abp.Quartz/Volo/Abp/Quartz/AbpQuartzJobFactory.cs @@ -1,14 +1,20 @@ using System; +using System.Collections.Concurrent; using Microsoft.Extensions.DependencyInjection; using Quartz; using Quartz.Spi; namespace Volo.Abp.Quartz { + /// + /// Get the job from the dependency injection + /// public class AbpQuartzJobFactory : IJobFactory { private readonly IServiceProvider _serviceProvider; + private readonly ConcurrentDictionary _scopes = new ConcurrentDictionary(); + public AbpQuartzJobFactory(IServiceProvider serviceProvider) { _serviceProvider = serviceProvider; @@ -16,12 +22,20 @@ namespace Volo.Abp.Quartz public IJob NewJob(TriggerFiredBundle bundle, IScheduler scheduler) { - return _serviceProvider.GetRequiredService(bundle.JobDetail.JobType) as IJob; + var scope = _serviceProvider.CreateScope(); + var job = scope.ServiceProvider.GetRequiredService(bundle.JobDetail.JobType) as IJob; + if (job == null) + { + throw new ArgumentException("Given job does not implement IJob"); + } + _scopes.TryAdd(job, scope); + return job; } public void ReturnJob(IJob job) { - (job as IDisposable)?.Dispose(); + _scopes.TryRemove(job, out var serviceScope); + serviceScope?.Dispose(); } } } From 31b0c00b4f0ef54a216a1582fe66726eb21fd447 Mon Sep 17 00:00:00 2001 From: liangshiwei Date: Tue, 25 Feb 2020 15:57:42 +0800 Subject: [PATCH 16/56] Add backgroundjobs.quartz demo app --- .../Volo/Abp/Quartz/AbpQuartzPreOptions.cs | 7 +- .../Volo.Abp.BackgroundJobs.sln | 17 +- .../DemoAppQuartzModule.cs | 47 +++ .../FodyWeavers.xml | 3 + .../FodyWeavers.xsd | 30 ++ .../Program.cs | 24 ++ ...o.Abp.BackgroundJobs.DemoApp.Quartz.csproj | 26 ++ .../appsettings.json | 5 + .../backgroundJobsDemoAppDb.sql | 368 ++++++++++++++++++ 9 files changed, 521 insertions(+), 6 deletions(-) create mode 100644 modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.Quartz/DemoAppQuartzModule.cs create mode 100644 modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.Quartz/FodyWeavers.xml create mode 100644 modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.Quartz/FodyWeavers.xsd create mode 100644 modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.Quartz/Program.cs create mode 100644 modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.Quartz/Volo.Abp.BackgroundJobs.DemoApp.Quartz.csproj create mode 100644 modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.Quartz/appsettings.json create mode 100644 modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.Quartz/backgroundJobsDemoAppDb.sql diff --git a/framework/src/Volo.Abp.Quartz/Volo/Abp/Quartz/AbpQuartzPreOptions.cs b/framework/src/Volo.Abp.Quartz/Volo/Abp/Quartz/AbpQuartzPreOptions.cs index 0c60ee13be..e86f993d1d 100644 --- a/framework/src/Volo.Abp.Quartz/Volo/Abp/Quartz/AbpQuartzPreOptions.cs +++ b/framework/src/Volo.Abp.Quartz/Volo/Abp/Quartz/AbpQuartzPreOptions.cs @@ -4,6 +4,11 @@ namespace Volo.Abp.Quartz { public class AbpQuartzPreOptions { - public NameValueCollection Properties => new NameValueCollection(); + public NameValueCollection Properties { get; set; } + + public AbpQuartzPreOptions() + { + Properties = new NameValueCollection(); + } } } diff --git a/modules/background-jobs/Volo.Abp.BackgroundJobs.sln b/modules/background-jobs/Volo.Abp.BackgroundJobs.sln index 09bfc90457..83263fa296 100644 --- a/modules/background-jobs/Volo.Abp.BackgroundJobs.sln +++ b/modules/background-jobs/Volo.Abp.BackgroundJobs.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 15 -VisualStudioVersion = 15.0.27703.2026 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.29519.87 MinimumVisualStudioVersion = 10.0.40219.1 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Volo.Abp.BackgroundJobs.Domain.Shared", "src\Volo.Abp.BackgroundJobs.Domain.Shared\Volo.Abp.BackgroundJobs.Domain.Shared.csproj", "{D64C1577-4929-4B60-939E-96DE1534891A}" EndProject @@ -27,11 +27,13 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Volo.Abp.BackgroundJobs.Mon EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Volo.Abp.BackgroundJobs.DemoApp", "app\Volo.Abp.BackgroundJobs.DemoApp\Volo.Abp.BackgroundJobs.DemoApp.csproj", "{9A871D66-BE8D-440C-BF79-F778F8A50BF3}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Volo.Abp.BackgroundJobs.DemoApp.Shared", "app\Volo.Abp.BackgroundJobs.DemoApp.Shared\Volo.Abp.BackgroundJobs.DemoApp.Shared.csproj", "{DE6914FF-F60A-461A-8498-461198E917BE}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Volo.Abp.BackgroundJobs.DemoApp.Shared", "app\Volo.Abp.BackgroundJobs.DemoApp.Shared\Volo.Abp.BackgroundJobs.DemoApp.Shared.csproj", "{DE6914FF-F60A-461A-8498-461198E917BE}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Volo.Abp.BackgroundJobs.DemoApp.HangFire", "app\Volo.Abp.BackgroundJobs.DemoApp.HangFire\Volo.Abp.BackgroundJobs.DemoApp.HangFire.csproj", "{2060AC85-2598-4342-A87C-A684A2C71A37}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Volo.Abp.BackgroundJobs.DemoApp.HangFire", "app\Volo.Abp.BackgroundJobs.DemoApp.HangFire\Volo.Abp.BackgroundJobs.DemoApp.HangFire.csproj", "{2060AC85-2598-4342-A87C-A684A2C71A37}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Volo.Abp.BackgroundJobs.DemoApp.RabbitMq", "app\Volo.Abp.BackgroundJobs.DemoApp.RabbitMq\Volo.Abp.BackgroundJobs.DemoApp.RabbitMq.csproj", "{7C8D03F7-165E-478C-A6D6-DC8229EEABB9}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Volo.Abp.BackgroundJobs.DemoApp.RabbitMq", "app\Volo.Abp.BackgroundJobs.DemoApp.RabbitMq\Volo.Abp.BackgroundJobs.DemoApp.RabbitMq.csproj", "{7C8D03F7-165E-478C-A6D6-DC8229EEABB9}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Volo.Abp.BackgroundJobs.DemoApp.Quartz", "app\Volo.Abp.BackgroundJobs.DemoApp.Quartz\Volo.Abp.BackgroundJobs.DemoApp.Quartz.csproj", "{0146891D-3FF8-4516-94D6-B9EFC37383CD}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -87,6 +89,10 @@ Global {7C8D03F7-165E-478C-A6D6-DC8229EEABB9}.Debug|Any CPU.Build.0 = Debug|Any CPU {7C8D03F7-165E-478C-A6D6-DC8229EEABB9}.Release|Any CPU.ActiveCfg = Release|Any CPU {7C8D03F7-165E-478C-A6D6-DC8229EEABB9}.Release|Any CPU.Build.0 = Release|Any CPU + {0146891D-3FF8-4516-94D6-B9EFC37383CD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {0146891D-3FF8-4516-94D6-B9EFC37383CD}.Debug|Any CPU.Build.0 = Debug|Any CPU + {0146891D-3FF8-4516-94D6-B9EFC37383CD}.Release|Any CPU.ActiveCfg = Release|Any CPU + {0146891D-3FF8-4516-94D6-B9EFC37383CD}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -104,6 +110,7 @@ Global {DE6914FF-F60A-461A-8498-461198E917BE} = {E400416D-2895-4512-9D17-90681EEC7E0A} {2060AC85-2598-4342-A87C-A684A2C71A37} = {E400416D-2895-4512-9D17-90681EEC7E0A} {7C8D03F7-165E-478C-A6D6-DC8229EEABB9} = {E400416D-2895-4512-9D17-90681EEC7E0A} + {0146891D-3FF8-4516-94D6-B9EFC37383CD} = {E400416D-2895-4512-9D17-90681EEC7E0A} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {4324B3B4-B60B-4E3C-91D8-59576B4E26DD} diff --git a/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.Quartz/DemoAppQuartzModule.cs b/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.Quartz/DemoAppQuartzModule.cs new file mode 100644 index 0000000000..331b83926e --- /dev/null +++ b/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.Quartz/DemoAppQuartzModule.cs @@ -0,0 +1,47 @@ +using System.Collections.Specialized; +using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.DependencyInjection; +using Volo.Abp.Autofac; +using Volo.Abp.BackgroundJobs.DemoApp.Shared; +using Volo.Abp.BackgroundJobs.Quartz; +using Volo.Abp.Modularity; +using Volo.Abp.Quartz; + +namespace Volo.Abp.BackgroundJobs.DemoApp.Quartz +{ + [DependsOn( + typeof(DemoAppSharedModule), + typeof(AbpAutofacModule), + typeof(AbpBackgroundJobsQuartzModule) + )] + public class DemoAppQuartzModule : AbpModule + { + public override void PreConfigureServices(ServiceConfigurationContext context) + { + var configuration = context.Services.GetConfiguration(); + + PreConfigure(options => + { + options.Properties = new NameValueCollection + { + ["quartz.jobStore.dataSource"] = "BackgroundJobsDemoApp", + ["quartz.jobStore.type"] = "Quartz.Impl.AdoJobStore.JobStoreTX, Quartz", + ["quartz.jobStore.tablePrefix"] = "QRTZ_", + ["quartz.serializer.type"] = "json", + ["quartz.dataSource.BackgroundJobsDemoApp.connectionString"] = configuration.GetConnectionString("Default"), + ["quartz.dataSource.BackgroundJobsDemoApp.provider"] = "SqlServer", + ["quartz.jobStore.driverDelegateType"] = "Quartz.Impl.AdoJobStore.SqlServerDelegate, Quartz", + }; + }); + } + + public override void OnApplicationInitialization(ApplicationInitializationContext context) + { + //TODO: Configure console logging + //context + // .ServiceProvider + // .GetRequiredService() + // .AddConsole(LogLevel.Debug); + } + } +} diff --git a/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.Quartz/FodyWeavers.xml b/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.Quartz/FodyWeavers.xml new file mode 100644 index 0000000000..00e1d9a1c1 --- /dev/null +++ b/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.Quartz/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.Quartz/FodyWeavers.xsd b/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.Quartz/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.Quartz/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/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.Quartz/Program.cs b/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.Quartz/Program.cs new file mode 100644 index 0000000000..9efe5e4350 --- /dev/null +++ b/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.Quartz/Program.cs @@ -0,0 +1,24 @@ +using System; + +namespace Volo.Abp.BackgroundJobs.DemoApp.Quartz +{ + class Program + { + static void Main(string[] args) + { + using (var application = AbpApplicationFactory.Create(options => + { + options.UseAutofac(); + })) + { + application.Initialize(); + + Console.WriteLine("Started: " + typeof(Program).Namespace); + Console.WriteLine("Press ENTER to stop the application..!"); + Console.ReadLine(); + + application.Shutdown(); + } + } + } +} diff --git a/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.Quartz/Volo.Abp.BackgroundJobs.DemoApp.Quartz.csproj b/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.Quartz/Volo.Abp.BackgroundJobs.DemoApp.Quartz.csproj new file mode 100644 index 0000000000..3920a454a3 --- /dev/null +++ b/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.Quartz/Volo.Abp.BackgroundJobs.DemoApp.Quartz.csproj @@ -0,0 +1,26 @@ + + + + + + Exe + netcoreapp3.1 + + + + + + + + + + + + + + + Always + + + + diff --git a/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.Quartz/appsettings.json b/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.Quartz/appsettings.json new file mode 100644 index 0000000000..e1e6966497 --- /dev/null +++ b/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.Quartz/appsettings.json @@ -0,0 +1,5 @@ +{ + "ConnectionStrings": { + "Default": "Server=localhost;Database=BackgroundJobsDemoApp;Trusted_Connection=True;MultipleActiveResultSets=true" + } +} \ No newline at end of file diff --git a/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.Quartz/backgroundJobsDemoAppDb.sql b/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.Quartz/backgroundJobsDemoAppDb.sql new file mode 100644 index 0000000000..fc7a06d507 --- /dev/null +++ b/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.Quartz/backgroundJobsDemoAppDb.sql @@ -0,0 +1,368 @@ +create database [BackgroundJobsDemoApp] +go +USE [BackgroundJobsDemoApp] +GO + +IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[dbo].[FK_QRTZ_TRIGGERS_QRTZ_JOB_DETAILS]') AND OBJECTPROPERTY(id, N'ISFOREIGNKEY') = 1) +ALTER TABLE [dbo].[QRTZ_TRIGGERS] DROP CONSTRAINT FK_QRTZ_TRIGGERS_QRTZ_JOB_DETAILS +GO + +IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[dbo].[FK_QRTZ_CRON_TRIGGERS_QRTZ_TRIGGERS]') AND OBJECTPROPERTY(id, N'ISFOREIGNKEY') = 1) +ALTER TABLE [dbo].[QRTZ_CRON_TRIGGERS] DROP CONSTRAINT FK_QRTZ_CRON_TRIGGERS_QRTZ_TRIGGERS +GO + +IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[dbo].[FK_QRTZ_SIMPLE_TRIGGERS_QRTZ_TRIGGERS]') AND OBJECTPROPERTY(id, N'ISFOREIGNKEY') = 1) +ALTER TABLE [dbo].[QRTZ_SIMPLE_TRIGGERS] DROP CONSTRAINT FK_QRTZ_SIMPLE_TRIGGERS_QRTZ_TRIGGERS +GO + +IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[dbo].[FK_QRTZ_SIMPROP_TRIGGERS_QRTZ_TRIGGERS]') AND OBJECTPROPERTY(id, N'ISFOREIGNKEY') = 1) +ALTER TABLE [dbo].[QRTZ_SIMPROP_TRIGGERS] DROP CONSTRAINT FK_QRTZ_SIMPROP_TRIGGERS_QRTZ_TRIGGERS +GO + +IF EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_QRTZ_JOB_LISTENERS_QRTZ_JOB_DETAILS]') AND parent_object_id = OBJECT_ID(N'[dbo].[QRTZ_JOB_LISTENERS]')) +ALTER TABLE [dbo].[QRTZ_JOB_LISTENERS] DROP CONSTRAINT [FK_QRTZ_JOB_LISTENERS_QRTZ_JOB_DETAILS] + +IF EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_QRTZ_TRIGGER_LISTENERS_QRTZ_TRIGGERS]') AND parent_object_id = OBJECT_ID(N'[dbo].[QRTZ_TRIGGER_LISTENERS]')) +ALTER TABLE [dbo].[QRTZ_TRIGGER_LISTENERS] DROP CONSTRAINT [FK_QRTZ_TRIGGER_LISTENERS_QRTZ_TRIGGERS] + + +IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[dbo].[QRTZ_CALENDARS]') AND OBJECTPROPERTY(id, N'ISUSERTABLE') = 1) +DROP TABLE [dbo].[QRTZ_CALENDARS] +GO + +IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[dbo].[QRTZ_CRON_TRIGGERS]') AND OBJECTPROPERTY(id, N'ISUSERTABLE') = 1) +DROP TABLE [dbo].[QRTZ_CRON_TRIGGERS] +GO + +IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[dbo].[QRTZ_BLOB_TRIGGERS]') AND OBJECTPROPERTY(id, N'ISUSERTABLE') = 1) +DROP TABLE [dbo].[QRTZ_BLOB_TRIGGERS] +GO + +IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[dbo].[QRTZ_FIRED_TRIGGERS]') AND OBJECTPROPERTY(id, N'ISUSERTABLE') = 1) +DROP TABLE [dbo].[QRTZ_FIRED_TRIGGERS] +GO + +IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[dbo].[QRTZ_PAUSED_TRIGGER_GRPS]') AND OBJECTPROPERTY(id, N'ISUSERTABLE') = 1) +DROP TABLE [dbo].[QRTZ_PAUSED_TRIGGER_GRPS] +GO + +IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[QRTZ_JOB_LISTENERS]') AND type in (N'U')) +DROP TABLE [dbo].[QRTZ_JOB_LISTENERS] + +IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[dbo].[QRTZ_SCHEDULER_STATE]') AND OBJECTPROPERTY(id, N'ISUSERTABLE') = 1) +DROP TABLE [dbo].[QRTZ_SCHEDULER_STATE] +GO + +IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[dbo].[QRTZ_LOCKS]') AND OBJECTPROPERTY(id, N'ISUSERTABLE') = 1) +DROP TABLE [dbo].[QRTZ_LOCKS] +GO +IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[QRTZ_TRIGGER_LISTENERS]') AND type in (N'U')) +DROP TABLE [dbo].[QRTZ_TRIGGER_LISTENERS] + + +IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[dbo].[QRTZ_JOB_DETAILS]') AND OBJECTPROPERTY(id, N'ISUSERTABLE') = 1) +DROP TABLE [dbo].[QRTZ_JOB_DETAILS] +GO + +IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[dbo].[QRTZ_SIMPLE_TRIGGERS]') AND OBJECTPROPERTY(id, N'ISUSERTABLE') = 1) +DROP TABLE [dbo].[QRTZ_SIMPLE_TRIGGERS] +GO + +IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[dbo].[QRTZ_SIMPROP_TRIGGERS]') AND OBJECTPROPERTY(id, N'ISUSERTABLE') = 1) +DROP TABLE [dbo].QRTZ_SIMPROP_TRIGGERS +GO + +IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[dbo].[QRTZ_TRIGGERS]') AND OBJECTPROPERTY(id, N'ISUSERTABLE') = 1) +DROP TABLE [dbo].[QRTZ_TRIGGERS] +GO + +CREATE TABLE [dbo].[QRTZ_CALENDARS] ( + [SCHED_NAME] [NVARCHAR] (120) NOT NULL , + [CALENDAR_NAME] [NVARCHAR] (200) NOT NULL , + [CALENDAR] [VARBINARY](MAX) NOT NULL +) +GO + +CREATE TABLE [dbo].[QRTZ_CRON_TRIGGERS] ( + [SCHED_NAME] [NVARCHAR] (120) NOT NULL , + [TRIGGER_NAME] [NVARCHAR] (150) NOT NULL , + [TRIGGER_GROUP] [NVARCHAR] (150) NOT NULL , + [CRON_EXPRESSION] [NVARCHAR] (120) NOT NULL , + [TIME_ZONE_ID] [NVARCHAR] (80) +) +GO + +CREATE TABLE [dbo].[QRTZ_FIRED_TRIGGERS] ( + [SCHED_NAME] [NVARCHAR] (120) NOT NULL , + [ENTRY_ID] [NVARCHAR] (140) NOT NULL , + [TRIGGER_NAME] [NVARCHAR] (150) NOT NULL , + [TRIGGER_GROUP] [NVARCHAR] (150) NOT NULL , + [INSTANCE_NAME] [NVARCHAR] (200) NOT NULL , + [FIRED_TIME] [BIGINT] NOT NULL , + [SCHED_TIME] [BIGINT] NOT NULL , + [PRIORITY] [INTEGER] NOT NULL , + [STATE] [NVARCHAR] (16) NOT NULL, + [JOB_NAME] [NVARCHAR] (150) NULL , + [JOB_GROUP] [NVARCHAR] (150) NULL , + [IS_NONCONCURRENT] BIT NULL , + [REQUESTS_RECOVERY] BIT NULL +) +GO + +CREATE TABLE [dbo].[QRTZ_PAUSED_TRIGGER_GRPS] ( + [SCHED_NAME] [NVARCHAR] (120) NOT NULL , + [TRIGGER_GROUP] [NVARCHAR] (150) NOT NULL +) +GO + +CREATE TABLE [dbo].[QRTZ_SCHEDULER_STATE] ( + [SCHED_NAME] [NVARCHAR] (120) NOT NULL , + [INSTANCE_NAME] [NVARCHAR] (200) NOT NULL , + [LAST_CHECKIN_TIME] [BIGINT] NOT NULL , + [CHECKIN_INTERVAL] [BIGINT] NOT NULL +) +GO + +CREATE TABLE [dbo].[QRTZ_LOCKS] ( + [SCHED_NAME] [NVARCHAR] (120) NOT NULL , + [LOCK_NAME] [NVARCHAR] (40) NOT NULL +) +GO + +CREATE TABLE [dbo].[QRTZ_JOB_DETAILS] ( + [SCHED_NAME] [NVARCHAR] (120) NOT NULL , + [JOB_NAME] [NVARCHAR] (150) NOT NULL , + [JOB_GROUP] [NVARCHAR] (150) NOT NULL , + [DESCRIPTION] [NVARCHAR] (250) NULL , + [JOB_CLASS_NAME] [NVARCHAR] (500) NOT NULL , + [IS_DURABLE] BIT NOT NULL , + [IS_NONCONCURRENT] BIT NOT NULL , + [IS_UPDATE_DATA] BIT NOT NULL , + [REQUESTS_RECOVERY] BIT NOT NULL , + [JOB_DATA] [VARBINARY](MAX) NULL +) +GO + +CREATE TABLE [dbo].[QRTZ_SIMPLE_TRIGGERS] ( + [SCHED_NAME] [NVARCHAR] (120) NOT NULL , + [TRIGGER_NAME] [NVARCHAR] (150) NOT NULL , + [TRIGGER_GROUP] [NVARCHAR] (150) NOT NULL , + [REPEAT_COUNT] [INTEGER] NOT NULL , + [REPEAT_INTERVAL] [BIGINT] NOT NULL , + [TIMES_TRIGGERED] [INTEGER] NOT NULL +) +GO + +CREATE TABLE [dbo].[QRTZ_SIMPROP_TRIGGERS] ( + [SCHED_NAME] [NVARCHAR] (120) NOT NULL , + [TRIGGER_NAME] [NVARCHAR] (150) NOT NULL , + [TRIGGER_GROUP] [NVARCHAR] (150) NOT NULL , + [STR_PROP_1] [NVARCHAR] (512) NULL, + [STR_PROP_2] [NVARCHAR] (512) NULL, + [STR_PROP_3] [NVARCHAR] (512) NULL, + [INT_PROP_1] [INT] NULL, + [INT_PROP_2] [INT] NULL, + [LONG_PROP_1] [BIGINT] NULL, + [LONG_PROP_2] [BIGINT] NULL, + [DEC_PROP_1] [NUMERIC] (13,4) NULL, + [DEC_PROP_2] [NUMERIC] (13,4) NULL, + [BOOL_PROP_1] BIT NULL, + [BOOL_PROP_2] BIT NULL, + [TIME_ZONE_ID] [NVARCHAR] (80) NULL +) +GO + +CREATE TABLE [dbo].[QRTZ_BLOB_TRIGGERS] ( + [SCHED_NAME] [NVARCHAR] (120) NOT NULL , + [TRIGGER_NAME] [NVARCHAR] (150) NOT NULL , + [TRIGGER_GROUP] [NVARCHAR] (150) NOT NULL , + [BLOB_DATA] [VARBINARY](MAX) NULL +) +GO + +CREATE TABLE [dbo].[QRTZ_TRIGGERS] ( + [SCHED_NAME] [NVARCHAR] (120) NOT NULL , + [TRIGGER_NAME] [NVARCHAR] (150) NOT NULL , + [TRIGGER_GROUP] [NVARCHAR] (150) NOT NULL , + [JOB_NAME] [NVARCHAR] (150) NOT NULL , + [JOB_GROUP] [NVARCHAR] (150) NOT NULL , + [DESCRIPTION] [NVARCHAR] (250) NULL , + [NEXT_FIRE_TIME] [BIGINT] NULL , + [PREV_FIRE_TIME] [BIGINT] NULL , + [PRIORITY] [INTEGER] NULL , + [TRIGGER_STATE] [NVARCHAR] (16) NOT NULL , + [TRIGGER_TYPE] [NVARCHAR] (8) NOT NULL , + [START_TIME] [BIGINT] NOT NULL , + [END_TIME] [BIGINT] NULL , + [CALENDAR_NAME] [NVARCHAR] (200) NULL , + [MISFIRE_INSTR] [INTEGER] NULL , + [JOB_DATA] [VARBINARY](MAX) NULL +) +GO + +ALTER TABLE [dbo].[QRTZ_CALENDARS] WITH NOCHECK ADD + CONSTRAINT [PK_QRTZ_CALENDARS] PRIMARY KEY CLUSTERED + ( + [SCHED_NAME], + [CALENDAR_NAME] + ) +GO + +ALTER TABLE [dbo].[QRTZ_CRON_TRIGGERS] WITH NOCHECK ADD + CONSTRAINT [PK_QRTZ_CRON_TRIGGERS] PRIMARY KEY CLUSTERED + ( + [SCHED_NAME], + [TRIGGER_NAME], + [TRIGGER_GROUP] + ) +GO + +ALTER TABLE [dbo].[QRTZ_FIRED_TRIGGERS] WITH NOCHECK ADD + CONSTRAINT [PK_QRTZ_FIRED_TRIGGERS] PRIMARY KEY CLUSTERED + ( + [SCHED_NAME], + [ENTRY_ID] + ) +GO + +ALTER TABLE [dbo].[QRTZ_PAUSED_TRIGGER_GRPS] WITH NOCHECK ADD + CONSTRAINT [PK_QRTZ_PAUSED_TRIGGER_GRPS] PRIMARY KEY CLUSTERED + ( + [SCHED_NAME], + [TRIGGER_GROUP] + ) +GO + +ALTER TABLE [dbo].[QRTZ_SCHEDULER_STATE] WITH NOCHECK ADD + CONSTRAINT [PK_QRTZ_SCHEDULER_STATE] PRIMARY KEY CLUSTERED + ( + [SCHED_NAME], + [INSTANCE_NAME] + ) +GO + +ALTER TABLE [dbo].[QRTZ_LOCKS] WITH NOCHECK ADD + CONSTRAINT [PK_QRTZ_LOCKS] PRIMARY KEY CLUSTERED + ( + [SCHED_NAME], + [LOCK_NAME] + ) +GO + +ALTER TABLE [dbo].[QRTZ_JOB_DETAILS] WITH NOCHECK ADD + CONSTRAINT [PK_QRTZ_JOB_DETAILS] PRIMARY KEY CLUSTERED + ( + [SCHED_NAME], + [JOB_NAME], + [JOB_GROUP] + ) +GO + +ALTER TABLE [dbo].[QRTZ_SIMPLE_TRIGGERS] WITH NOCHECK ADD + CONSTRAINT [PK_QRTZ_SIMPLE_TRIGGERS] PRIMARY KEY CLUSTERED + ( + [SCHED_NAME], + [TRIGGER_NAME], + [TRIGGER_GROUP] + ) +GO + +ALTER TABLE [dbo].[QRTZ_SIMPROP_TRIGGERS] WITH NOCHECK ADD + CONSTRAINT [PK_QRTZ_SIMPROP_TRIGGERS] PRIMARY KEY CLUSTERED + ( + [SCHED_NAME], + [TRIGGER_NAME], + [TRIGGER_GROUP] + ) +GO + +ALTER TABLE [dbo].[QRTZ_TRIGGERS] WITH NOCHECK ADD + CONSTRAINT [PK_QRTZ_TRIGGERS] PRIMARY KEY CLUSTERED + ( + [SCHED_NAME], + [TRIGGER_NAME], + [TRIGGER_GROUP] + ) +GO + +ALTER TABLE [dbo].QRTZ_BLOB_TRIGGERS WITH NOCHECK ADD + CONSTRAINT [PK_QRTZ_BLOB_TRIGGERS] PRIMARY KEY CLUSTERED + ( + [SCHED_NAME], + [TRIGGER_NAME], + [TRIGGER_GROUP] + ) +GO + +ALTER TABLE [dbo].[QRTZ_CRON_TRIGGERS] ADD + CONSTRAINT [FK_QRTZ_CRON_TRIGGERS_QRTZ_TRIGGERS] FOREIGN KEY + ( + [SCHED_NAME], + [TRIGGER_NAME], + [TRIGGER_GROUP] + ) REFERENCES [dbo].[QRTZ_TRIGGERS] ( + [SCHED_NAME], + [TRIGGER_NAME], + [TRIGGER_GROUP] + ) ON DELETE CASCADE +GO + +ALTER TABLE [dbo].[QRTZ_SIMPLE_TRIGGERS] ADD + CONSTRAINT [FK_QRTZ_SIMPLE_TRIGGERS_QRTZ_TRIGGERS] FOREIGN KEY + ( + [SCHED_NAME], + [TRIGGER_NAME], + [TRIGGER_GROUP] + ) REFERENCES [dbo].[QRTZ_TRIGGERS] ( + [SCHED_NAME], + [TRIGGER_NAME], + [TRIGGER_GROUP] + ) ON DELETE CASCADE +GO + +ALTER TABLE [dbo].[QRTZ_SIMPROP_TRIGGERS] ADD + CONSTRAINT [FK_QRTZ_SIMPROP_TRIGGERS_QRTZ_TRIGGERS] FOREIGN KEY + ( + [SCHED_NAME], + [TRIGGER_NAME], + [TRIGGER_GROUP] + ) REFERENCES [dbo].[QRTZ_TRIGGERS] ( + [SCHED_NAME], + [TRIGGER_NAME], + [TRIGGER_GROUP] + ) ON DELETE CASCADE +GO + +ALTER TABLE [dbo].[QRTZ_TRIGGERS] ADD + CONSTRAINT [FK_QRTZ_TRIGGERS_QRTZ_JOB_DETAILS] FOREIGN KEY + ( + [SCHED_NAME], + [JOB_NAME], + [JOB_GROUP] + ) REFERENCES [dbo].[QRTZ_JOB_DETAILS] ( + [SCHED_NAME], + [JOB_NAME], + [JOB_GROUP] + ) +GO + +CREATE INDEX IDX_QRTZ_T_J ON QRTZ_TRIGGERS(SCHED_NAME,JOB_NAME,JOB_GROUP) +CREATE INDEX IDX_QRTZ_T_JG ON QRTZ_TRIGGERS(SCHED_NAME,JOB_GROUP) +CREATE INDEX IDX_QRTZ_T_C ON QRTZ_TRIGGERS(SCHED_NAME,CALENDAR_NAME) +CREATE INDEX IDX_QRTZ_T_G ON QRTZ_TRIGGERS(SCHED_NAME,TRIGGER_GROUP) +CREATE INDEX IDX_QRTZ_T_STATE ON QRTZ_TRIGGERS(SCHED_NAME,TRIGGER_STATE) +CREATE INDEX IDX_QRTZ_T_N_STATE ON QRTZ_TRIGGERS(SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP,TRIGGER_STATE) +CREATE INDEX IDX_QRTZ_T_N_G_STATE ON QRTZ_TRIGGERS(SCHED_NAME,TRIGGER_GROUP,TRIGGER_STATE) +CREATE INDEX IDX_QRTZ_T_NEXT_FIRE_TIME ON QRTZ_TRIGGERS(SCHED_NAME,NEXT_FIRE_TIME) +CREATE INDEX IDX_QRTZ_T_NFT_ST ON QRTZ_TRIGGERS(SCHED_NAME,TRIGGER_STATE,NEXT_FIRE_TIME) +CREATE INDEX IDX_QRTZ_T_NFT_MISFIRE ON QRTZ_TRIGGERS(SCHED_NAME,MISFIRE_INSTR,NEXT_FIRE_TIME) +CREATE INDEX IDX_QRTZ_T_NFT_ST_MISFIRE ON QRTZ_TRIGGERS(SCHED_NAME,MISFIRE_INSTR,NEXT_FIRE_TIME,TRIGGER_STATE) +CREATE INDEX IDX_QRTZ_T_NFT_ST_MISFIRE_GRP ON QRTZ_TRIGGERS(SCHED_NAME,MISFIRE_INSTR,NEXT_FIRE_TIME,TRIGGER_GROUP,TRIGGER_STATE) + +CREATE INDEX IDX_QRTZ_FT_TRIG_INST_NAME ON QRTZ_FIRED_TRIGGERS(SCHED_NAME,INSTANCE_NAME) +CREATE INDEX IDX_QRTZ_FT_INST_JOB_REQ_RCVRY ON QRTZ_FIRED_TRIGGERS(SCHED_NAME,INSTANCE_NAME,REQUESTS_RECOVERY) +CREATE INDEX IDX_QRTZ_FT_J_G ON QRTZ_FIRED_TRIGGERS(SCHED_NAME,JOB_NAME,JOB_GROUP) +CREATE INDEX IDX_QRTZ_FT_JG ON QRTZ_FIRED_TRIGGERS(SCHED_NAME,JOB_GROUP) +CREATE INDEX IDX_QRTZ_FT_T_G ON QRTZ_FIRED_TRIGGERS(SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP) +CREATE INDEX IDX_QRTZ_FT_TG ON QRTZ_FIRED_TRIGGERS(SCHED_NAME,TRIGGER_GROUP) +GO \ No newline at end of file From 11d5e101d818656d7eee779bc511f61db1b7fc6d Mon Sep 17 00:00:00 2001 From: maliming Date: Tue, 25 Feb 2020 16:27:37 +0800 Subject: [PATCH 17/56] Fix documentation link. Fix #2906 --- modules/docs/src/Volo.Docs.Web/Pages/Documents/Index.cshtml | 2 +- modules/docs/src/Volo.Docs.Web/Pages/Documents/Index.cshtml.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/docs/src/Volo.Docs.Web/Pages/Documents/Index.cshtml b/modules/docs/src/Volo.Docs.Web/Pages/Documents/Index.cshtml index 5d973cf16f..e029f2685e 100644 --- a/modules/docs/src/Volo.Docs.Web/Pages/Documents/Index.cshtml +++ b/modules/docs/src/Volo.Docs.Web/Pages/Documents/Index.cshtml @@ -29,7 +29,7 @@ {
  • - + @project.Name

    diff --git a/modules/docs/src/Volo.Docs.Web/Pages/Documents/Index.cshtml.cs b/modules/docs/src/Volo.Docs.Web/Pages/Documents/Index.cshtml.cs index 9e21ec22de..50db79cb43 100644 --- a/modules/docs/src/Volo.Docs.Web/Pages/Documents/Index.cshtml.cs +++ b/modules/docs/src/Volo.Docs.Web/Pages/Documents/Index.cshtml.cs @@ -33,7 +33,7 @@ namespace Volo.Docs.Pages.Documents if (listResult.Items.Count == 1) { - return Redirect("." + DocumentsUrlPrefix + listResult.Items[0].ShortName); + return Redirect(DocumentsUrlPrefix + listResult.Items[0].ShortName); } Projects = listResult.Items; From d7a7802ce2bf98de45e881af4d438ceb37391a74 Mon Sep 17 00:00:00 2001 From: Yunus Emre Kalkan Date: Tue, 25 Feb 2020 15:09:13 +0300 Subject: [PATCH 18/56] Linking module source-code improvements --- .../Volo/Abp/Cli/Commands/AddModuleCommand.cs | 11 +- .../Volo/Abp/Cli/Commands/GetSourceCommand.cs | 81 ++++-------- .../Services/SourceCodeDownloadService.cs | 82 ++++++++++++ .../ModuleWithMastersInfo.cs | 9 ++ .../SolutionFileModifier.cs | 117 ++++++++++++++++++ .../SolutionModuleAdder.cs | 60 +++++++-- 6 files changed, 291 insertions(+), 69 deletions(-) create mode 100644 framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/Services/SourceCodeDownloadService.cs create mode 100644 framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/ModuleWithMastersInfo.cs create mode 100644 framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/SolutionFileModifier.cs diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/AddModuleCommand.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/AddModuleCommand.cs index 58adc65fc4..3b7c8e6166 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/AddModuleCommand.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/AddModuleCommand.cs @@ -37,11 +37,15 @@ namespace Volo.Abp.Cli.Commands var skipDbMigrations = Convert.ToBoolean( commandLineArgs.Options.GetOrNull(Options.DbMigrations.Skip) ?? "false"); + var version = commandLineArgs.Options.GetOrNull(Options.Version.Short, Options.Version.Long); + await SolutionModuleAdder.AddAsync( GetSolutionFile(commandLineArgs), commandLineArgs.Target, commandLineArgs.Options.GetOrNull(Options.StartupProject.Short, Options.StartupProject.Long), - skipDbMigrations + version, + skipDbMigrations, + commandLineArgs.Options.ContainsKey("with-source-code") ); } @@ -126,6 +130,11 @@ namespace Volo.Abp.Cli.Commands public const string Short = "s"; public const string Long = "solution"; } + public static class Version + { + public const string Short = "v"; + public const string Long = "version"; + } public static class DbMigrations { diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/GetSourceCommand.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/GetSourceCommand.cs index e1536c2973..91c5837900 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/GetSourceCommand.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/GetSourceCommand.cs @@ -7,6 +7,7 @@ using ICSharpCode.SharpZipLib.Zip; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging.Abstractions; using Volo.Abp.Cli.Args; +using Volo.Abp.Cli.Commands.Services; using Volo.Abp.Cli.ProjectBuilding; using Volo.Abp.Cli.ProjectBuilding.Building; using Volo.Abp.DependencyInjection; @@ -15,12 +16,14 @@ namespace Volo.Abp.Cli.Commands { public class GetSourceCommand : IConsoleCommand, ITransientDependency { + private readonly SourceCodeDownloadService _sourceCodeDownloadService; public ModuleProjectBuilder ModuleProjectBuilder { get; } public ILogger Logger { get; set; } - public GetSourceCommand(ModuleProjectBuilder moduleProjectBuilder) + public GetSourceCommand(ModuleProjectBuilder moduleProjectBuilder, SourceCodeDownloadService sourceCodeDownloadService) { + _sourceCodeDownloadService = sourceCodeDownloadService; ModuleProjectBuilder = moduleProjectBuilder; Logger = NullLogger.Instance; } @@ -36,29 +39,13 @@ namespace Volo.Abp.Cli.Commands ); } - Logger.LogInformation("Downloading source code of " + commandLineArgs.Target); - var version = commandLineArgs.Options.GetOrNull(Options.Version.Short, Options.Version.Long); if (version != null) { Logger.LogInformation("Version: " + version); } - var outputFolder = commandLineArgs.Options.GetOrNull(Options.OutputFolder.Short, Options.OutputFolder.Long); - if (outputFolder != null) - { - if (!Directory.Exists(outputFolder)) - { - Directory.CreateDirectory(outputFolder); - } - - outputFolder = Path.GetFullPath(outputFolder); - } - else - { - outputFolder = Directory.GetCurrentDirectory(); - } - + var outputFolder = GetOutPutFolder(commandLineArgs); Logger.LogInformation("Output folder: " + outputFolder); var gitHubLocalRepositoryPath = commandLineArgs.Options.GetOrNull(Options.GitHubLocalRepositoryPath.Long); @@ -69,52 +56,28 @@ namespace Volo.Abp.Cli.Commands commandLineArgs.Options.Add(CliConsts.Command, commandLineArgs.Command); - var result = await ModuleProjectBuilder.BuildAsync( - new ProjectBuildArgs( - SolutionName.Parse(commandLineArgs.Target), - commandLineArgs.Target, - version, - DatabaseProvider.NotSpecified, - UiFramework.NotSpecified, - gitHubLocalRepositoryPath, - commandLineArgs.Options - ) - ); - - using (var templateFileStream = new MemoryStream(result.ZipContent)) + await _sourceCodeDownloadService.DownloadAsync( + commandLineArgs.Target, outputFolder, version, gitHubLocalRepositoryPath, commandLineArgs.Options); + } + + private static string GetOutPutFolder(CommandLineArgs commandLineArgs) + { + var outputFolder = commandLineArgs.Options.GetOrNull(Options.OutputFolder.Short, Options.OutputFolder.Long); + if (outputFolder != null) { - using (var zipInputStream = new ZipInputStream(templateFileStream)) + if (!Directory.Exists(outputFolder)) { - var zipEntry = zipInputStream.GetNextEntry(); - while (zipEntry != null) - { - var fullZipToPath = Path.Combine(outputFolder, zipEntry.Name); - var directoryName = Path.GetDirectoryName(fullZipToPath); - - if (!string.IsNullOrEmpty(directoryName)) - { - Directory.CreateDirectory(directoryName); - } - - var fileName = Path.GetFileName(fullZipToPath); - if (fileName.Length == 0) - { - zipEntry = zipInputStream.GetNextEntry(); - continue; - } - - var buffer = new byte[4096]; // 4K is optimum - using (var streamWriter = File.Create(fullZipToPath)) - { - StreamUtils.Copy(zipInputStream, streamWriter, buffer); - } - - zipEntry = zipInputStream.GetNextEntry(); - } + Directory.CreateDirectory(outputFolder); } + + outputFolder = Path.GetFullPath(outputFolder); + } + else + { + outputFolder = Directory.GetCurrentDirectory(); } - Logger.LogInformation($"'{commandLineArgs.Target}' has been successfully downloaded to '{outputFolder}'"); + return outputFolder; } public string GetUsageInfo() diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/Services/SourceCodeDownloadService.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/Services/SourceCodeDownloadService.cs new file mode 100644 index 0000000000..1055b43f61 --- /dev/null +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/Services/SourceCodeDownloadService.cs @@ -0,0 +1,82 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Text; +using System.Threading.Tasks; +using ICSharpCode.SharpZipLib.Core; +using ICSharpCode.SharpZipLib.Zip; +using Microsoft.Extensions.Logging; +using Microsoft.Extensions.Logging.Abstractions; +using Volo.Abp.Cli.Args; +using Volo.Abp.Cli.ProjectBuilding; +using Volo.Abp.Cli.ProjectBuilding.Building; +using Volo.Abp.DependencyInjection; + +namespace Volo.Abp.Cli.Commands.Services +{ + public class SourceCodeDownloadService : ITransientDependency + { + public ModuleProjectBuilder ModuleProjectBuilder { get; } + public ILogger Logger { get; set; } + + public SourceCodeDownloadService(ModuleProjectBuilder moduleProjectBuilder) + { + ModuleProjectBuilder = moduleProjectBuilder; + Logger = NullLogger.Instance; + } + + public async Task DownloadAsync(string moduleName, string outputFolder, string version, string gitHubLocalRepositoryPath, AbpCommandLineOptions options) + { + Logger.LogInformation("Downloading source code of " + moduleName); + Logger.LogInformation("Version: " + version); + Logger.LogInformation("Output folder: " + outputFolder); + + var result = await ModuleProjectBuilder.BuildAsync( + new ProjectBuildArgs( + SolutionName.Parse(moduleName), + moduleName, + version, + DatabaseProvider.NotSpecified, + UiFramework.NotSpecified, + gitHubLocalRepositoryPath, + options + ) + ); + + using (var templateFileStream = new MemoryStream(result.ZipContent)) + { + using (var zipInputStream = new ZipInputStream(templateFileStream)) + { + var zipEntry = zipInputStream.GetNextEntry(); + while (zipEntry != null) + { + var fullZipToPath = Path.Combine(outputFolder, zipEntry.Name); + var directoryName = Path.GetDirectoryName(fullZipToPath); + + if (!string.IsNullOrEmpty(directoryName)) + { + Directory.CreateDirectory(directoryName); + } + + var fileName = Path.GetFileName(fullZipToPath); + if (fileName.Length == 0) + { + zipEntry = zipInputStream.GetNextEntry(); + continue; + } + + var buffer = new byte[4096]; // 4K is optimum + using (var streamWriter = File.Create(fullZipToPath)) + { + StreamUtils.Copy(zipInputStream, streamWriter, buffer); + } + + zipEntry = zipInputStream.GetNextEntry(); + } + } + } + + Logger.LogInformation($"'{moduleName}' has been successfully downloaded to '{outputFolder}'"); + } + } +} diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/ModuleWithMastersInfo.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/ModuleWithMastersInfo.cs new file mode 100644 index 0000000000..07d6e12349 --- /dev/null +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/ModuleWithMastersInfo.cs @@ -0,0 +1,9 @@ +using System.Collections.Generic; + +namespace Volo.Abp.Cli.ProjectModification +{ + public class ModuleWithMastersInfo : ModuleInfo + { + public List MasterModuleInfos { get; set; } + } +} \ No newline at end of file diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/SolutionFileModifier.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/SolutionFileModifier.cs new file mode 100644 index 0000000000..4eabeaa846 --- /dev/null +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/SolutionFileModifier.cs @@ -0,0 +1,117 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Volo.Abp.DependencyInjection; + +namespace Volo.Abp.Cli.ProjectModification +{ + public class SolutionFileModifier : ITransientDependency + { + public async Task AddModuleToSolutionFileAsync(ModuleWithMastersInfo module, string solutionFile) + { + await AddModule(module, solutionFile); + } + + private async Task AddModule(ModuleWithMastersInfo module, string solutionFile) + { + var srcModuleFolderId = await AddNewFolderAndGetIdOrGetExistingId(solutionFile, module.Name, await AddNewFolderAndGetIdOrGetExistingId(solutionFile, "modules")); + var testModuleFolderId = await AddNewFolderAndGetIdOrGetExistingId(solutionFile, module.Name + ".Tests", await AddNewFolderAndGetIdOrGetExistingId(solutionFile, "test")); + + var file = File.ReadAllText(solutionFile); + var lines = file.Split(Environment.NewLine).ToList(); + + + var projectsUnderModule = Directory.GetFiles( + Path.Combine(Path.GetDirectoryName(solutionFile), "modules", module.Name), + "*.csproj", + SearchOption.AllDirectories); + + var projectsUnderTest = Directory.GetFiles( + Path.Combine(Path.GetDirectoryName(solutionFile), "modules", module.Name, "test"), + "*.csproj", + SearchOption.AllDirectories); + + foreach (var projectPath in projectsUnderModule) + { + var parentFolderId = projectsUnderTest.Contains(projectPath) ? testModuleFolderId : srcModuleFolderId; + var projectId = Path.GetFileName(projectPath).Replace(".csproj",""); + var projectParentFolderInModule = projectsUnderTest.Contains(projectPath) ? "test" : "src"; + + if (lines.Any(l => l.Contains($"\"{projectId}\""))) + { + continue; + } + + var projectGuid = Guid.NewGuid().ToString(); + + var newProjectLine = "Project(\"{9A19103F-16F7-4668-BE54-9A1E7A4F7556}\") = \"" + projectId + "\"," + + " \"modules\\" + module.Name + "\\"+ projectParentFolderInModule + "\\" + projectId + "\\" + projectId + ".csproj\", \"{" + projectGuid + "}\"" + + Environment.NewLine + "EndProject"; + + lines.InsertAfter(l => l.Trim().Equals("EndProject"), newProjectLine); + + var newPostSolutionLine = + " {" + projectGuid + "}.Debug|Any CPU.ActiveCfg = Debug|Any CPU" + Environment.NewLine + + " {" + projectGuid + "}.Debug|Any CPU.Build.0 = Debug|Any CPU" + Environment.NewLine + + " {" + projectGuid + "}.Release|Any CPU.ActiveCfg = Release|Any CPU" + Environment.NewLine + + " {" + projectGuid + "}.Release|Any CPU.Build.0 = Release|Any CPU"; + + lines.InsertAfter(l=>l.Contains("GlobalSection") && l.Contains("ProjectConfigurationPlatforms"), newPostSolutionLine); + + var newPreSolutionLine = + " {"+ projectGuid + "} = {"+ parentFolderId + "}"; + + lines.InsertAfter(l=>l.Contains("GlobalSection") && l.Contains("NestedProjects"), newPreSolutionLine); + } + + File.WriteAllText(solutionFile, string.Join(Environment.NewLine, lines)); + + if (module.MasterModuleInfos != null) + { + foreach (var masterModule in module.MasterModuleInfos) + { + await AddModule(masterModule, solutionFile); + } + } + } + + private async Task AddNewFolderAndGetIdOrGetExistingId(string solutionFile, string folderName, string parentFolderId = null) + { + var file = File.ReadAllText(solutionFile); + var lines = file.Split(Environment.NewLine).ToList(); + string folderId; + + var folderLineIndex = lines.FindIndex(l => + l.Contains("2150E333-8FDC-42A3-9474-1A3956D46DE8") && l.Contains("\""+ folderName + "\"")); + + if (folderLineIndex < 0) + { + folderId = Guid.NewGuid().ToString(); + var newFolderLine = "Project(\"{2150E333-8FDC-42A3-9474-1A3956D46DE8}\") = \""+ folderName + "\", \""+ folderName + "\", \"{" + folderId + "}\"" + + Environment.NewLine + "EndProject"; + + lines.InsertAfter(l => l.Trim().Equals("EndProject"), newFolderLine); + + if (parentFolderId != null) + { + var newPreSolutionLine = + " {" + folderId + "} = {" + parentFolderId + "}"; + + lines.InsertAfter(l => l.Contains("GlobalSection") && l.Contains("NestedProjects"), newPreSolutionLine); + } + } + else + { + folderId = lines[folderLineIndex].Replace("\"", " ").Replace("{", " ").Replace("}", " ").TrimEnd() + .Split(" ").Last(); + } + + File.WriteAllText(solutionFile, string.Join(Environment.NewLine, lines)); + + return folderId; + } + } +} diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/SolutionModuleAdder.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/SolutionModuleAdder.cs index d8a376eb02..1f74f0df66 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/SolutionModuleAdder.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/SolutionModuleAdder.cs @@ -7,6 +7,7 @@ using System.IO; using System.Linq; using System.Net; using System.Threading.Tasks; +using Volo.Abp.Cli.Commands.Services; using Volo.Abp.Cli.Http; using Volo.Abp.Cli.ProjectBuilding; using Volo.Abp.DependencyInjection; @@ -26,6 +27,8 @@ namespace Volo.Abp.Cli.ProjectModification protected ProjectNpmPackageAdder ProjectNpmPackageAdder { get; } protected NpmGlobalPackagesChecker NpmGlobalPackagesChecker { get; } protected IRemoteServiceExceptionHandler RemoteServiceExceptionHandler { get; } + public SourceCodeDownloadService SourceCodeDownloadService { get; } + public SolutionFileModifier SolutionFileModifier { get; } public SolutionModuleAdder( IJsonSerializer jsonSerializer, @@ -35,7 +38,9 @@ namespace Volo.Abp.Cli.ProjectModification DerivedClassFinder derivedClassFinder, ProjectNpmPackageAdder projectNpmPackageAdder, NpmGlobalPackagesChecker npmGlobalPackagesChecker, - IRemoteServiceExceptionHandler remoteServiceExceptionHandler) + IRemoteServiceExceptionHandler remoteServiceExceptionHandler, + SourceCodeDownloadService sourceCodeDownloadService, + SolutionFileModifier solutionFileModifier) { JsonSerializer = jsonSerializer; ProjectNugetPackageAdder = projectNugetPackageAdder; @@ -45,6 +50,8 @@ namespace Volo.Abp.Cli.ProjectModification ProjectNpmPackageAdder = projectNpmPackageAdder; NpmGlobalPackagesChecker = npmGlobalPackagesChecker; RemoteServiceExceptionHandler = remoteServiceExceptionHandler; + SourceCodeDownloadService = sourceCodeDownloadService; + SolutionFileModifier = solutionFileModifier; Logger = NullLogger.Instance; } @@ -52,7 +59,9 @@ namespace Volo.Abp.Cli.ProjectModification [NotNull] string solutionFile, [NotNull] string moduleName, string startupProject, - bool skipDbMigrations = false) + string version, + bool skipDbMigrations = false, + bool withSourceCode = false) { Check.NotNull(solutionFile, nameof(solutionFile)); Check.NotNull(moduleName, nameof(moduleName)); @@ -63,6 +72,41 @@ namespace Volo.Abp.Cli.ProjectModification var projectFiles = ProjectFinder.GetProjectFiles(solutionFile); + await AddNugetAndNpmReferences(module, projectFiles); + + if (withSourceCode) + { + var modulesFolderInSolution = Path.Combine(Path.GetDirectoryName(solutionFile), "modules"); + await DownloadSourceCodesToSolutionFolder(module, modulesFolderInSolution, version); + await SolutionFileModifier.AddModuleToSolutionFileAsync(module, solutionFile); + } + + ModifyDbContext(projectFiles, module, startupProject, skipDbMigrations); + } + + private async Task DownloadSourceCodesToSolutionFolder(ModuleWithMastersInfo module, string modulesFolderInSolution, string version = null) + { + await SourceCodeDownloadService.DownloadAsync( + module.Name, + Path.Combine(modulesFolderInSolution, module.Name), + version, + null, + null + ); + + if (module.MasterModuleInfos == null) + { + return; + } + + foreach (var masterModule in module.MasterModuleInfos) + { + await DownloadSourceCodesToSolutionFolder(masterModule, modulesFolderInSolution, version); + } + } + + private async Task AddNugetAndNpmReferences(ModuleWithMastersInfo module, string[] projectFiles) + { foreach (var nugetPackage in module.NugetPackages) { var targetProjectFile = ProjectFinder.FindNuGetTargetProjectFile(projectFiles, nugetPackage.Target); @@ -84,7 +128,8 @@ namespace Volo.Abp.Cli.ProjectModification foreach (var targetProject in targetProjects) { - foreach (var npmPackage in module.NpmPackages.Where(p => p.ApplicationType.HasFlag(NpmApplicationType.Mvc))) + foreach (var npmPackage in module.NpmPackages.Where(p => + p.ApplicationType.HasFlag(NpmApplicationType.Mvc))) { await ProjectNpmPackageAdder.AddAsync(Path.GetDirectoryName(targetProject), npmPackage); } @@ -95,8 +140,6 @@ namespace Volo.Abp.Cli.ProjectModification Logger.LogDebug("Target project is not available for NPM packages."); } } - - ModifyDbContext(projectFiles, module, startupProject, skipDbMigrations); } protected void ModifyDbContext(string[] projectFiles, ModuleInfo module, string startupProject, bool skipDbMigrations = false) @@ -129,18 +172,17 @@ namespace Volo.Abp.Cli.ProjectModification DbContextFileBuilderConfigureAdder.Add(dbContextFile, module.EfCoreConfigureMethodName); - if (!skipDbMigrations) { EfCoreMigrationAdder.AddMigration(dbMigrationsProject, module.Name, startupProject); } } - protected virtual async Task FindModuleInfoAsync(string moduleName) + protected virtual async Task FindModuleInfoAsync(string moduleName) { using (var client = new CliHttpClient()) { - var url = $"{CliUrls.WwwAbpIo}api/app/module/byName/?name=" + moduleName; + var url = $"{CliUrls.WwwAbpIo}api/app/module/byNameWithDetails/?name=" + moduleName; var response = await client.GetAsync(url); @@ -155,7 +197,7 @@ namespace Volo.Abp.Cli.ProjectModification } var responseContent = await response.Content.ReadAsStringAsync(); - return JsonSerializer.Deserialize(responseContent); + return JsonSerializer.Deserialize(responseContent); } } } From eb100ff9537d2d394a17cb9694d69f9b3b2c5fa5 Mon Sep 17 00:00:00 2001 From: AkinCam <172804016@ogr.cbu.edu.tr> Date: Tue, 25 Feb 2020 23:29:04 +0300 Subject: [PATCH 19/56] Modified postAppService for getting recent posts --- .../Volo/Blogging/Posts/IPostAppService.cs | 2 +- .../Volo/Blogging/Posts/PostDto.cs | 27 +++++++++++++++++++ .../BloggingApplicationAutoMapperProfile.cs | 1 + .../Volo/Blogging/Posts/PostAppService.cs | 14 +++++++--- .../Volo/Blogging/PostsController.cs | 2 +- 5 files changed, 40 insertions(+), 6 deletions(-) create mode 100644 modules/blogging/src/Volo.Blogging.Application.Contracts/Volo/Blogging/Posts/PostDto.cs diff --git a/modules/blogging/src/Volo.Blogging.Application.Contracts/Volo/Blogging/Posts/IPostAppService.cs b/modules/blogging/src/Volo.Blogging.Application.Contracts/Volo/Blogging/Posts/IPostAppService.cs index c16a8903e8..b28c184ce7 100644 --- a/modules/blogging/src/Volo.Blogging.Application.Contracts/Volo/Blogging/Posts/IPostAppService.cs +++ b/modules/blogging/src/Volo.Blogging.Application.Contracts/Volo/Blogging/Posts/IPostAppService.cs @@ -9,7 +9,7 @@ namespace Volo.Blogging.Posts { Task> GetListByBlogIdAndTagName(Guid blogId, string tagName); - Task> GetOrderedListPostsByTime(); + Task> GetOrderedListPostsByTime(); Task GetForReadingAsync(GetPostInput input); diff --git a/modules/blogging/src/Volo.Blogging.Application.Contracts/Volo/Blogging/Posts/PostDto.cs b/modules/blogging/src/Volo.Blogging.Application.Contracts/Volo/Blogging/Posts/PostDto.cs new file mode 100644 index 0000000000..a4d4364a96 --- /dev/null +++ b/modules/blogging/src/Volo.Blogging.Application.Contracts/Volo/Blogging/Posts/PostDto.cs @@ -0,0 +1,27 @@ +using System; +using System.Collections.Generic; +using System.Text; +using Volo.Abp.Application.Dtos; + +namespace Volo.Blogging.Posts +{ + public class PostDto : FullAuditedEntityDto + { + public Guid BlogId { get; set; } + + public string Title { get; set; } + + public string CoverImage { get; set; } + + public string Url { get; set; } + + public string Content { get; set; } + + public string UserName { get; set; } + + public int ReadCount { get; set; } + + public int CommentCount { get; set; } + + } +} diff --git a/modules/blogging/src/Volo.Blogging.Application/Volo/Blogging/BloggingApplicationAutoMapperProfile.cs b/modules/blogging/src/Volo.Blogging.Application/Volo/Blogging/BloggingApplicationAutoMapperProfile.cs index b9e3cf0dea..a018a318ae 100644 --- a/modules/blogging/src/Volo.Blogging.Application/Volo/Blogging/BloggingApplicationAutoMapperProfile.cs +++ b/modules/blogging/src/Volo.Blogging.Application/Volo/Blogging/BloggingApplicationAutoMapperProfile.cs @@ -18,6 +18,7 @@ namespace Volo.Blogging CreateMap(); CreateMap(); CreateMap().Ignore(x=>x.Writer).Ignore(x=>x.CommentCount).Ignore(x=>x.Tags); + CreateMap().Ignore(x => x.UserName).Ignore(x => x.CommentCount); CreateMap().Ignore(x => x.Writer); CreateMap(); } diff --git a/modules/blogging/src/Volo.Blogging.Application/Volo/Blogging/Posts/PostAppService.cs b/modules/blogging/src/Volo.Blogging.Application/Volo/Blogging/Posts/PostAppService.cs index a23309a33a..d0bd0802e5 100644 --- a/modules/blogging/src/Volo.Blogging.Application/Volo/Blogging/Posts/PostAppService.cs +++ b/modules/blogging/src/Volo.Blogging.Application/Volo/Blogging/Posts/PostAppService.cs @@ -72,16 +72,22 @@ namespace Volo.Blogging.Posts return new ListResultDto(postDtos); } - public async Task> GetOrderedListPostsByTime() + public async Task> GetOrderedListPostsByTime() { var posts = (await _postRepository.GetListAsync()).OrderByDescending(x => x.CreationTime).ToList(); - var postDtos = new List(ObjectMapper.Map, List>(posts)); + var postDtos = new List(ObjectMapper.Map, List>(posts)); foreach (var postDto in postDtos) { - postDto.Tags = await GetTagsOfPost(postDto.Id); + if (postDto.CreatorId.HasValue) + { + var creatorUser = await UserLookupService.FindByIdAsync(postDto.CreatorId.Value); + + postDto.UserName = ObjectMapper.Map(creatorUser).UserName; + } } - return new ListResultDto(postDtos); + + return new ListResultDto(postDtos); } public async Task GetForReadingAsync(GetPostInput input) diff --git a/modules/blogging/src/Volo.Blogging.HttpApi/Volo/Blogging/PostsController.cs b/modules/blogging/src/Volo.Blogging.HttpApi/Volo/Blogging/PostsController.cs index 1b465f83c2..c320744f96 100644 --- a/modules/blogging/src/Volo.Blogging.HttpApi/Volo/Blogging/PostsController.cs +++ b/modules/blogging/src/Volo.Blogging.HttpApi/Volo/Blogging/PostsController.cs @@ -29,7 +29,7 @@ namespace Volo.Blogging [HttpGet] - public Task> GetOrderedListPostsByTime() + public Task> GetOrderedListPostsByTime() { return _postAppService.GetOrderedListPostsByTime(); } From dc1981f91dfbb30c3e9414c09f4e226282ce5dfe Mon Sep 17 00:00:00 2001 From: maliming Date: Wed, 26 Feb 2020 11:18:07 +0800 Subject: [PATCH 20/56] Fix scopes may be null bug. --- .../Pages/Consent.cshtml.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/modules/account/src/Volo.Abp.Account.Web.IdentityServer/Pages/Consent.cshtml.cs b/modules/account/src/Volo.Abp.Account.Web.IdentityServer/Pages/Consent.cshtml.cs index 3fb68feaca..c583005188 100644 --- a/modules/account/src/Volo.Abp.Account.Web.IdentityServer/Pages/Consent.cshtml.cs +++ b/modules/account/src/Volo.Abp.Account.Web.IdentityServer/Pages/Consent.cshtml.cs @@ -187,7 +187,9 @@ namespace Volo.Abp.Account.Web.Pages public List GetAllowedScopeNames() { - return IdentityScopes.Union(ApiScopes).Where(s => s.Checked).Select(s => s.Name).ToList(); + var identityScopes = IdentityScopes ?? new List(); + var apiScopes = IdentityScopes ?? new List(); + return identityScopes.Union(apiScopes).Where(s => s.Checked).Select(s => s.Name).ToList(); } } From db6233e620ec247dbdbd5c2bc2905cdb050ffc0d Mon Sep 17 00:00:00 2001 From: Yunus Emre Kalkan Date: Wed, 26 Feb 2020 09:30:00 +0300 Subject: [PATCH 21/56] added ReplaceConfigureAwaitPropsStep --- .../ModuleProjectBuildPipelineBuilder.cs | 1 + .../Steps/ReplaceConfigureAwaitPropsStep.cs | 84 +++++++++++++++++++ 2 files changed, 85 insertions(+) create mode 100644 framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/ReplaceConfigureAwaitPropsStep.cs diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/ModuleProjectBuildPipelineBuilder.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/ModuleProjectBuildPipelineBuilder.cs index 5eba01b388..9b66f17834 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/ModuleProjectBuildPipelineBuilder.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/ModuleProjectBuildPipelineBuilder.cs @@ -11,6 +11,7 @@ namespace Volo.Abp.Cli.ProjectBuilding.Building pipeline.Steps.Add(new FileEntryListReadStep()); pipeline.Steps.Add(new ProjectReferenceReplaceStep()); pipeline.Steps.Add(new ReplaceCommonPropsStep()); + pipeline.Steps.Add(new ReplaceConfigureAwaitPropsStep()); pipeline.Steps.Add(new CreateProjectResultZipStep()); return pipeline; diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/ReplaceConfigureAwaitPropsStep.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/ReplaceConfigureAwaitPropsStep.cs new file mode 100644 index 0000000000..6d96a889bd --- /dev/null +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/ReplaceConfigureAwaitPropsStep.cs @@ -0,0 +1,84 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Text.RegularExpressions; +using System.Xml; +using Volo.Abp.Cli.ProjectBuilding.Files; + +namespace Volo.Abp.Cli.ProjectBuilding.Building.Steps +{ + public class ReplaceConfigureAwaitPropsStep : ProjectBuildPipelineStep + { + public override void Execute(ProjectBuildContext context) + { + new ConfigureAwaitPropsReplacer(context.Files).Run(); + } + + private class ConfigureAwaitPropsReplacer + { + private readonly List _entries; + + public ConfigureAwaitPropsReplacer( + List entries) + { + _entries = entries; + } + + public void Run() + { + foreach (var fileEntry in _entries) + { + if (fileEntry.Name.EndsWith(".csproj")) + { + fileEntry.SetContent(ProcessFileContent(fileEntry.Content)); + } + } + } + + private string ProcessFileContent(string content) + { + Check.NotNull(content, nameof(content)); + + var doc = new XmlDocument() { PreserveWhitespace = true }; + + doc.Load(GenerateStreamFromString(content)); + + return ProcessReferenceNodes(doc, content); + } + + private string ProcessReferenceNodes(XmlDocument doc, string content) + { + Check.NotNull(content, nameof(content)); + + var importNodes = doc.SelectNodes("/Project/Import[@Project]"); + + if (importNodes == null) + { + return doc.OuterXml; + } + + foreach (XmlNode node in importNodes) + { + if (!(node.Attributes?["Project"]?.Value?.EndsWith("\\configureawait.props") ?? false)) + { + continue; + } + + node.ParentNode?.RemoveChild(node); + } + + return doc.OuterXml; + } + + private static Stream GenerateStreamFromString(string s) + { + var stream = new MemoryStream(); + var writer = new StreamWriter(stream); + writer.Write(s); + writer.Flush(); + stream.Position = 0; + return stream; + } + } + } +} From d84784782531dbe36b3bef073aa5c90b161e895e Mon Sep 17 00:00:00 2001 From: Yunus Emre Kalkan Date: Wed, 26 Feb 2020 11:56:26 +0300 Subject: [PATCH 22/56] added NugetPackageToLocalReferenceConverter --- .../NugetPackageToLocalReferenceConverter.cs | 136 ++++++++++++++++++ .../SolutionModuleAdder.cs | 10 +- 2 files changed, 143 insertions(+), 3 deletions(-) create mode 100644 framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/NugetPackageToLocalReferenceConverter.cs diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/NugetPackageToLocalReferenceConverter.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/NugetPackageToLocalReferenceConverter.cs new file mode 100644 index 0000000000..61b5f5975a --- /dev/null +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/NugetPackageToLocalReferenceConverter.cs @@ -0,0 +1,136 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Xml; +using Volo.Abp.DependencyInjection; + +namespace Volo.Abp.Cli.ProjectModification +{ + public class NugetPackageToLocalReferenceConverter : ITransientDependency + { + public async Task Convert(ModuleWithMastersInfo module, string solutionFile) + { + var nugetPackageList = GetNugetPackages(module); + + var projectFilesUnderModules = GetProjectFilesUnder(Path.Combine(Path.GetDirectoryName(solutionFile), "modules")); ; + var projectFilesUnderSrc = GetProjectFilesUnder(Path.Combine(Path.GetDirectoryName(solutionFile), "src")); ; + var projectFilesUnderTest = GetProjectFilesUnder(Path.Combine(Path.GetDirectoryName(solutionFile), "test")); ; + + foreach (var projectFile in projectFilesUnderModules) + { + ConvertToLocalReference(projectFile, nugetPackageList, "..\\..\\..\\"); + } + foreach (var projectFile in projectFilesUnderSrc) + { + ConvertToLocalReference(projectFile, nugetPackageList, "..\\..\\modules\\"); + } + foreach (var projectFile in projectFilesUnderTest) + { + ConvertToLocalReference(projectFile, nugetPackageList, "..\\..\\modules\\", "test"); + } + } + + private void ConvertToLocalReference(string projectFile, List nugetPackageList, string localPathPrefix, string sourceFile = "src") + { + var content = File.ReadAllText(projectFile); + var doc = new XmlDocument() { PreserveWhitespace = true }; + + doc.Load(GenerateStreamFromString(content)); + + var convertedProject = ProcessReferenceNodes(doc, nugetPackageList, localPathPrefix, sourceFile); + + File.WriteAllText(projectFile, convertedProject); + } + + + private string ProcessReferenceNodes(XmlDocument doc, List nugetPackageList, string localPathPrefix, string sourceFile = "src") + { + var nodes = doc.SelectNodes("/Project/ItemGroup/PackageReference[@Include]"); + + if (nodes == null) + { + return doc.OuterXml; + } + + foreach (XmlNode oldNode in nodes) + { + var oldNodeIncludeValue = oldNode?.Attributes?["Include"]?.Value; + + var nugetPackage = nugetPackageList.FirstOrDefault(n => n.NugetPackage.Name == oldNodeIncludeValue); + + if (nugetPackage == null) + { + continue; + } + + var referenceProjectPath = + $"{localPathPrefix}{nugetPackage.ModuleName}\\{sourceFile}\\{nugetPackage.NugetPackage.Name}\\{nugetPackage.NugetPackage.Name}.csproj"; + + XmlNode newNode = GetNewReferenceNode(doc, referenceProjectPath); + + oldNode?.ParentNode?.ReplaceChild(newNode, oldNode); + } + + return doc.OuterXml; + } + + protected XmlElement GetNewReferenceNode(XmlDocument doc, string newValue) + { + var newNode = doc.CreateElement("ProjectReference"); + + var includeAttr = doc.CreateAttribute("Include"); + includeAttr.Value = newValue; + newNode.Attributes.Append(includeAttr); + + return newNode; + } + + public List GetNugetPackages(ModuleWithMastersInfo module) + { + var list = new List(); + + list.AddRange(module.NugetPackages.Select(n => new NugetPackageInfoWithModuleName + { + ModuleName = module.Name, + NugetPackage = n + })); + + if (module.MasterModuleInfos != null) + { + foreach (var masterModule in module.MasterModuleInfos) + { + list.AddRange(GetNugetPackages(masterModule)); + } + } + + return list; + } + + private static string[] GetProjectFilesUnder(string path) + { + return Directory.GetFiles(path, + "*.csproj", + SearchOption.AllDirectories); + } + + private static Stream GenerateStreamFromString(string s) + { + var stream = new MemoryStream(); + var writer = new StreamWriter(stream); + writer.Write(s); + writer.Flush(); + stream.Position = 0; + return stream; + } + + public class NugetPackageInfoWithModuleName + { + public NugetPackageInfo NugetPackage { get; set; } + + public string ModuleName { get; set; } + } + } +} diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/SolutionModuleAdder.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/SolutionModuleAdder.cs index 1f74f0df66..5dd6aa4337 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/SolutionModuleAdder.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/SolutionModuleAdder.cs @@ -29,6 +29,7 @@ namespace Volo.Abp.Cli.ProjectModification protected IRemoteServiceExceptionHandler RemoteServiceExceptionHandler { get; } public SourceCodeDownloadService SourceCodeDownloadService { get; } public SolutionFileModifier SolutionFileModifier { get; } + public NugetPackageToLocalReferenceConverter NugetPackageToLocalReferenceConverter { get; } public SolutionModuleAdder( IJsonSerializer jsonSerializer, @@ -40,7 +41,8 @@ namespace Volo.Abp.Cli.ProjectModification NpmGlobalPackagesChecker npmGlobalPackagesChecker, IRemoteServiceExceptionHandler remoteServiceExceptionHandler, SourceCodeDownloadService sourceCodeDownloadService, - SolutionFileModifier solutionFileModifier) + SolutionFileModifier solutionFileModifier, + NugetPackageToLocalReferenceConverter nugetPackageToLocalReferenceConverter) { JsonSerializer = jsonSerializer; ProjectNugetPackageAdder = projectNugetPackageAdder; @@ -52,6 +54,7 @@ namespace Volo.Abp.Cli.ProjectModification RemoteServiceExceptionHandler = remoteServiceExceptionHandler; SourceCodeDownloadService = sourceCodeDownloadService; SolutionFileModifier = solutionFileModifier; + NugetPackageToLocalReferenceConverter = nugetPackageToLocalReferenceConverter; Logger = NullLogger.Instance; } @@ -72,16 +75,17 @@ namespace Volo.Abp.Cli.ProjectModification var projectFiles = ProjectFinder.GetProjectFiles(solutionFile); - await AddNugetAndNpmReferences(module, projectFiles); + //await AddNugetAndNpmReferences(module, projectFiles); if (withSourceCode) { var modulesFolderInSolution = Path.Combine(Path.GetDirectoryName(solutionFile), "modules"); await DownloadSourceCodesToSolutionFolder(module, modulesFolderInSolution, version); await SolutionFileModifier.AddModuleToSolutionFileAsync(module, solutionFile); + await NugetPackageToLocalReferenceConverter.Convert(module, solutionFile); } - ModifyDbContext(projectFiles, module, startupProject, skipDbMigrations); + //ModifyDbContext(projectFiles, module, startupProject, skipDbMigrations); } private async Task DownloadSourceCodesToSolutionFolder(ModuleWithMastersInfo module, string modulesFolderInSolution, string version = null) From 530fd3a6e38d8b19b50cb5f402ee109ee66eab4d Mon Sep 17 00:00:00 2001 From: Yunus Emre Kalkan Date: Wed, 26 Feb 2020 15:38:16 +0300 Subject: [PATCH 23/56] add-module improvements --- .../Volo/Abp/Cli/Commands/AddModuleCommand.cs | 16 +++++++-- .../Steps/ProjectReferenceReplaceStep.cs | 13 ++----- .../Building/Steps/ReplaceCommonPropsStep.cs | 13 ++----- .../Steps/ReplaceConfigureAwaitPropsStep.cs | 13 ++----- .../DbContextFileBuilderConfigureAdder.cs | 9 +++-- .../ProjectModification/DerivedClassFinder.cs | 1 - .../NugetPackageToLocalReferenceConverter.cs | 19 +++------- .../ProjectNpmPackageAdder.cs | 2 +- .../ProjectNugetPackageAdder.cs | 5 +++ .../SolutionAbpVersionFinder.cs | 36 +++++++++++++++++++ .../SolutionModuleAdder.cs | 8 ++--- .../Volo/Abp/Cli/Utils/StreamHelper.cs | 20 +++++++++++ 12 files changed, 97 insertions(+), 58 deletions(-) create mode 100644 framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/SolutionAbpVersionFinder.cs create mode 100644 framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Utils/StreamHelper.cs diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/AddModuleCommand.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/AddModuleCommand.cs index 3b7c8e6166..3d58fafd3b 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/AddModuleCommand.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/AddModuleCommand.cs @@ -16,10 +16,12 @@ namespace Volo.Abp.Cli.Commands public ILogger Logger { get; set; } protected SolutionModuleAdder SolutionModuleAdder { get; } + public SolutionAbpVersionFinder SolutionAbpVersionFinder { get; } - public AddModuleCommand(SolutionModuleAdder solutionModuleAdder) + public AddModuleCommand(SolutionModuleAdder solutionModuleAdder, SolutionAbpVersionFinder solutionAbpVersionFinder) { SolutionModuleAdder = solutionModuleAdder; + SolutionAbpVersionFinder = solutionAbpVersionFinder; Logger = NullLogger.Instance; } @@ -34,18 +36,26 @@ namespace Volo.Abp.Cli.Commands ); } + var withSourceCode = commandLineArgs.Options.ContainsKey("with-source-code"); + var skipDbMigrations = Convert.ToBoolean( commandLineArgs.Options.GetOrNull(Options.DbMigrations.Skip) ?? "false"); + var solutionFile = GetSolutionFile(commandLineArgs); + var version = commandLineArgs.Options.GetOrNull(Options.Version.Short, Options.Version.Long); + if (version == null) + { + version = SolutionAbpVersionFinder.Find(solutionFile); + } await SolutionModuleAdder.AddAsync( - GetSolutionFile(commandLineArgs), + solutionFile, commandLineArgs.Target, commandLineArgs.Options.GetOrNull(Options.StartupProject.Short, Options.StartupProject.Long), version, skipDbMigrations, - commandLineArgs.Options.ContainsKey("with-source-code") + withSourceCode ); } diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/ProjectReferenceReplaceStep.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/ProjectReferenceReplaceStep.cs index 29f5afb19c..a7fd3f529f 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/ProjectReferenceReplaceStep.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/ProjectReferenceReplaceStep.cs @@ -4,6 +4,7 @@ using System.IO; using System.Text.RegularExpressions; using System.Xml; using Volo.Abp.Cli.ProjectBuilding.Files; +using Volo.Abp.Cli.Utils; namespace Volo.Abp.Cli.ProjectBuilding.Building.Steps { @@ -92,7 +93,7 @@ namespace Volo.Abp.Cli.ProjectBuilding.Building.Steps var doc = new XmlDocument() { PreserveWhitespace = true }; - doc.Load(GenerateStreamFromString(content)); + doc.Load(StreamHelper.GenerateStreamFromString(content)); return ProcessReferenceNodes(doc, content); } @@ -125,16 +126,6 @@ namespace Volo.Abp.Cli.ProjectBuilding.Building.Steps protected abstract XmlElement GetNewReferenceNode(XmlDocument doc, string oldNodeIncludeValue); - private static Stream GenerateStreamFromString(string s) - { - var stream = new MemoryStream(); - var writer = new StreamWriter(stream); - writer.Write(s); - writer.Flush(); - stream.Position = 0; - return stream; - } - public class NugetReferenceReplacer : ProjectReferenceReplacer { diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/ReplaceCommonPropsStep.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/ReplaceCommonPropsStep.cs index 07b2081738..862ac39b09 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/ReplaceCommonPropsStep.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/ReplaceCommonPropsStep.cs @@ -4,6 +4,7 @@ using System.IO; using System.Text.RegularExpressions; using System.Xml; using Volo.Abp.Cli.ProjectBuilding.Files; +using Volo.Abp.Cli.Utils; namespace Volo.Abp.Cli.ProjectBuilding.Building.Steps { @@ -41,7 +42,7 @@ namespace Volo.Abp.Cli.ProjectBuilding.Building.Steps var doc = new XmlDocument() { PreserveWhitespace = true }; - doc.Load(GenerateStreamFromString(content)); + doc.Load(StreamHelper.GenerateStreamFromString(content)); return ProcessReferenceNodes(doc, content); } @@ -81,16 +82,6 @@ namespace Volo.Abp.Cli.ProjectBuilding.Building.Steps return doc.OuterXml; } - - private static Stream GenerateStreamFromString(string s) - { - var stream = new MemoryStream(); - var writer = new StreamWriter(stream); - writer.Write(s); - writer.Flush(); - stream.Position = 0; - return stream; - } } } } diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/ReplaceConfigureAwaitPropsStep.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/ReplaceConfigureAwaitPropsStep.cs index 6d96a889bd..1541284009 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/ReplaceConfigureAwaitPropsStep.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/ReplaceConfigureAwaitPropsStep.cs @@ -4,6 +4,7 @@ using System.IO; using System.Text.RegularExpressions; using System.Xml; using Volo.Abp.Cli.ProjectBuilding.Files; +using Volo.Abp.Cli.Utils; namespace Volo.Abp.Cli.ProjectBuilding.Building.Steps { @@ -41,7 +42,7 @@ namespace Volo.Abp.Cli.ProjectBuilding.Building.Steps var doc = new XmlDocument() { PreserveWhitespace = true }; - doc.Load(GenerateStreamFromString(content)); + doc.Load(StreamHelper.GenerateStreamFromString(content)); return ProcessReferenceNodes(doc, content); } @@ -69,16 +70,6 @@ namespace Volo.Abp.Cli.ProjectBuilding.Building.Steps return doc.OuterXml; } - - private static Stream GenerateStreamFromString(string s) - { - var stream = new MemoryStream(); - var writer = new StreamWriter(stream); - writer.Write(s); - writer.Flush(); - stream.Position = 0; - return stream; - } } } } diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/DbContextFileBuilderConfigureAdder.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/DbContextFileBuilderConfigureAdder.cs index 0211a42243..d369a9af43 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/DbContextFileBuilderConfigureAdder.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/DbContextFileBuilderConfigureAdder.cs @@ -18,7 +18,7 @@ namespace Volo.Abp.Cli.ProjectModification Logger = NullLogger.Instance; } - public void Add(string path, string moduleConfiguration) + public bool Add(string path, string moduleConfiguration) { var file = File.ReadAllText(path); @@ -32,13 +32,18 @@ namespace Volo.Abp.Cli.ProjectModification if (indexToInsert <= 0 || indexToInsert >= file.Length) { Logger.LogWarning($"\"OnModelCreating(ModelBuilder builder)\" method couldn't be found in {path}"); - return; + return false; } file = file.Insert(indexToInsert, " " + stringToAdd + Environment.NewLine + " "); } + else + { + return false; + } File.WriteAllText(path, file); + return true; } protected int FindIndexToInsert(string file) diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/DerivedClassFinder.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/DerivedClassFinder.cs index 4cf3209955..8da03763c6 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/DerivedClassFinder.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/DerivedClassFinder.cs @@ -53,7 +53,6 @@ namespace Volo.Abp.Cli.ProjectModification protected bool IsDerived(string csFile, string baseClass) { - Logger.LogDebug(csFile); var root = CSharpSyntaxTree.ParseText(File.ReadAllText(csFile)).GetRoot(); var namespaceSyntax = root.DescendantNodes().OfType().First(); var classDeclaration = (namespaceSyntax.DescendantNodes().OfType()).First(); diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/NugetPackageToLocalReferenceConverter.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/NugetPackageToLocalReferenceConverter.cs index 61b5f5975a..b1d514eef2 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/NugetPackageToLocalReferenceConverter.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/NugetPackageToLocalReferenceConverter.cs @@ -5,6 +5,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; using System.Xml; +using Volo.Abp.Cli.Utils; using Volo.Abp.DependencyInjection; namespace Volo.Abp.Cli.ProjectModification @@ -15,9 +16,9 @@ namespace Volo.Abp.Cli.ProjectModification { var nugetPackageList = GetNugetPackages(module); - var projectFilesUnderModules = GetProjectFilesUnder(Path.Combine(Path.GetDirectoryName(solutionFile), "modules")); ; - var projectFilesUnderSrc = GetProjectFilesUnder(Path.Combine(Path.GetDirectoryName(solutionFile), "src")); ; - var projectFilesUnderTest = GetProjectFilesUnder(Path.Combine(Path.GetDirectoryName(solutionFile), "test")); ; + var projectFilesUnderModules = GetProjectFilesUnder(Path.Combine(Path.GetDirectoryName(solutionFile), "modules")); + var projectFilesUnderSrc = GetProjectFilesUnder(Path.Combine(Path.GetDirectoryName(solutionFile), "src")); + var projectFilesUnderTest = GetProjectFilesUnder(Path.Combine(Path.GetDirectoryName(solutionFile), "test")); foreach (var projectFile in projectFilesUnderModules) { @@ -38,7 +39,7 @@ namespace Volo.Abp.Cli.ProjectModification var content = File.ReadAllText(projectFile); var doc = new XmlDocument() { PreserveWhitespace = true }; - doc.Load(GenerateStreamFromString(content)); + doc.Load(StreamHelper.GenerateStreamFromString(content)); var convertedProject = ProcessReferenceNodes(doc, nugetPackageList, localPathPrefix, sourceFile); @@ -116,16 +117,6 @@ namespace Volo.Abp.Cli.ProjectModification SearchOption.AllDirectories); } - private static Stream GenerateStreamFromString(string s) - { - var stream = new MemoryStream(); - var writer = new StreamWriter(stream); - writer.Write(s); - writer.Flush(); - stream.Position = 0; - return stream; - } - public class NugetPackageInfoWithModuleName { public NugetPackageInfo NugetPackage { get; set; } diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/ProjectNpmPackageAdder.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/ProjectNpmPackageAdder.cs index 63e0eb0393..eeb19e8621 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/ProjectNpmPackageAdder.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/ProjectNpmPackageAdder.cs @@ -20,7 +20,7 @@ namespace Volo.Abp.Cli.ProjectModification public Task AddAsync(string directory, NpmPackageInfo npmPackage) { var packageJsonFilePath = Path.Combine(directory, "package.json"); - if (!File.Exists(packageJsonFilePath)) + if (!File.Exists(packageJsonFilePath) || File.ReadAllText(packageJsonFilePath).Contains($"\"{npmPackage.Name}\"")) { return Task.CompletedTask; } diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/ProjectNugetPackageAdder.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/ProjectNugetPackageAdder.cs index 62dee30344..a69957a497 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/ProjectNugetPackageAdder.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/ProjectNugetPackageAdder.cs @@ -50,6 +50,11 @@ namespace Volo.Abp.Cli.ProjectModification public Task AddAsync(string projectFile, NugetPackageInfo package) { + if (File.ReadAllText(projectFile).Contains($"\"{package.Name}\"")) + { + return Task.CompletedTask; + } + using (DirectoryHelper.ChangeCurrentDirectory(Path.GetDirectoryName(projectFile))) { Logger.LogInformation($"Installing '{package.Name}' package to the project '{Path.GetFileNameWithoutExtension(projectFile)}'..."); diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/SolutionAbpVersionFinder.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/SolutionAbpVersionFinder.cs new file mode 100644 index 0000000000..a86d17fee2 --- /dev/null +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/SolutionAbpVersionFinder.cs @@ -0,0 +1,36 @@ +using System.IO; +using System.Xml; +using Volo.Abp.Cli.Utils; +using Volo.Abp.DependencyInjection; + +namespace Volo.Abp.Cli.ProjectModification +{ + public class SolutionAbpVersionFinder : ITransientDependency + { + public string Find(string solutionFile) + { + var projectFilesUnderSrc = Directory.GetFiles(Path.GetDirectoryName(solutionFile), + "*.csproj", + SearchOption.AllDirectories); + + foreach (var projectFile in projectFilesUnderSrc) + { + var content = File.ReadAllText(projectFile); + var doc = new XmlDocument() { PreserveWhitespace = true }; + + doc.Load(StreamHelper.GenerateStreamFromString(content)); + + var nodes = doc.SelectNodes("/Project/ItemGroup/PackageReference[starts-with(@Include, 'Volo.Abp')]"); + + var value = nodes?[0]?.Attributes?["Version"]?.Value; + + if (value != null) + { + return value; + } + } + + return null; + } + } +} diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/SolutionModuleAdder.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/SolutionModuleAdder.cs index 5dd6aa4337..8ded87bf6f 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/SolutionModuleAdder.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/SolutionModuleAdder.cs @@ -75,7 +75,7 @@ namespace Volo.Abp.Cli.ProjectModification var projectFiles = ProjectFinder.GetProjectFiles(solutionFile); - //await AddNugetAndNpmReferences(module, projectFiles); + await AddNugetAndNpmReferences(module, projectFiles); if (withSourceCode) { @@ -85,7 +85,7 @@ namespace Volo.Abp.Cli.ProjectModification await NugetPackageToLocalReferenceConverter.Convert(module, solutionFile); } - //ModifyDbContext(projectFiles, module, startupProject, skipDbMigrations); + ModifyDbContext(projectFiles, module, startupProject, skipDbMigrations); } private async Task DownloadSourceCodesToSolutionFolder(ModuleWithMastersInfo module, string modulesFolderInSolution, string version = null) @@ -174,9 +174,9 @@ namespace Volo.Abp.Cli.ProjectModification return; } - DbContextFileBuilderConfigureAdder.Add(dbContextFile, module.EfCoreConfigureMethodName); + var addedNewBuilder = DbContextFileBuilderConfigureAdder.Add(dbContextFile, module.EfCoreConfigureMethodName); - if (!skipDbMigrations) + if (addedNewBuilder && !skipDbMigrations) { EfCoreMigrationAdder.AddMigration(dbMigrationsProject, module.Name, startupProject); } diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Utils/StreamHelper.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Utils/StreamHelper.cs new file mode 100644 index 0000000000..1f8aefe070 --- /dev/null +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Utils/StreamHelper.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Text; + +namespace Volo.Abp.Cli.Utils +{ + public static class StreamHelper + { + public static Stream GenerateStreamFromString(string s) + { + var stream = new MemoryStream(); + var writer = new StreamWriter(stream); + writer.Write(s); + writer.Flush(); + stream.Position = 0; + return stream; + } + } +} From 34b4c0773c934cd6c60835f589e2bde1f5867194 Mon Sep 17 00:00:00 2001 From: Yunus Emre Kalkan Date: Thu, 27 Feb 2020 09:27:19 +0300 Subject: [PATCH 24/56] update add-module help --- .../Volo/Abp/Cli/Commands/AddModuleCommand.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/AddModuleCommand.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/AddModuleCommand.cs index 3d58fafd3b..b37f67fd1a 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/AddModuleCommand.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/AddModuleCommand.cs @@ -71,8 +71,9 @@ namespace Volo.Abp.Cli.Commands sb.AppendLine(" abp add-module [options]"); sb.AppendLine(""); sb.AppendLine("Options:"); - sb.AppendLine(" -s|--solution Specify the solution file explicitly."); - sb.AppendLine(" --skip-db-migrations Specify if a new migration will be added or not."); + sb.AppendLine(" --with-source-code Downloads the source code of the module and adds it to your solution."); + sb.AppendLine(" -s|--solution Specify the solution file explicitly."); + sb.AppendLine(" --skip-db-migrations Specify if a new migration will be added or not."); sb.AppendLine(" -sp|--startup-project Relative path to the project folder of the startup project. Default value is the current folder."); sb.AppendLine(""); sb.AppendLine("Examples:"); From 5815a2a514c94296053b9d62b05d8d8923529827 Mon Sep 17 00:00:00 2001 From: liangshiwei Date: Fri, 28 Feb 2020 16:42:17 +0800 Subject: [PATCH 25/56] Quartz demoapp switch to ramstore --- .../DemoAppQuartzModule.cs | 19 - .../backgroundJobsDemoAppDb.sql | 368 ------------------ 2 files changed, 387 deletions(-) delete mode 100644 modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.Quartz/backgroundJobsDemoAppDb.sql diff --git a/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.Quartz/DemoAppQuartzModule.cs b/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.Quartz/DemoAppQuartzModule.cs index 331b83926e..76c8815a9f 100644 --- a/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.Quartz/DemoAppQuartzModule.cs +++ b/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.Quartz/DemoAppQuartzModule.cs @@ -16,25 +16,6 @@ namespace Volo.Abp.BackgroundJobs.DemoApp.Quartz )] public class DemoAppQuartzModule : AbpModule { - public override void PreConfigureServices(ServiceConfigurationContext context) - { - var configuration = context.Services.GetConfiguration(); - - PreConfigure(options => - { - options.Properties = new NameValueCollection - { - ["quartz.jobStore.dataSource"] = "BackgroundJobsDemoApp", - ["quartz.jobStore.type"] = "Quartz.Impl.AdoJobStore.JobStoreTX, Quartz", - ["quartz.jobStore.tablePrefix"] = "QRTZ_", - ["quartz.serializer.type"] = "json", - ["quartz.dataSource.BackgroundJobsDemoApp.connectionString"] = configuration.GetConnectionString("Default"), - ["quartz.dataSource.BackgroundJobsDemoApp.provider"] = "SqlServer", - ["quartz.jobStore.driverDelegateType"] = "Quartz.Impl.AdoJobStore.SqlServerDelegate, Quartz", - }; - }); - } - public override void OnApplicationInitialization(ApplicationInitializationContext context) { //TODO: Configure console logging diff --git a/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.Quartz/backgroundJobsDemoAppDb.sql b/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.Quartz/backgroundJobsDemoAppDb.sql deleted file mode 100644 index fc7a06d507..0000000000 --- a/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.Quartz/backgroundJobsDemoAppDb.sql +++ /dev/null @@ -1,368 +0,0 @@ -create database [BackgroundJobsDemoApp] -go -USE [BackgroundJobsDemoApp] -GO - -IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[dbo].[FK_QRTZ_TRIGGERS_QRTZ_JOB_DETAILS]') AND OBJECTPROPERTY(id, N'ISFOREIGNKEY') = 1) -ALTER TABLE [dbo].[QRTZ_TRIGGERS] DROP CONSTRAINT FK_QRTZ_TRIGGERS_QRTZ_JOB_DETAILS -GO - -IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[dbo].[FK_QRTZ_CRON_TRIGGERS_QRTZ_TRIGGERS]') AND OBJECTPROPERTY(id, N'ISFOREIGNKEY') = 1) -ALTER TABLE [dbo].[QRTZ_CRON_TRIGGERS] DROP CONSTRAINT FK_QRTZ_CRON_TRIGGERS_QRTZ_TRIGGERS -GO - -IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[dbo].[FK_QRTZ_SIMPLE_TRIGGERS_QRTZ_TRIGGERS]') AND OBJECTPROPERTY(id, N'ISFOREIGNKEY') = 1) -ALTER TABLE [dbo].[QRTZ_SIMPLE_TRIGGERS] DROP CONSTRAINT FK_QRTZ_SIMPLE_TRIGGERS_QRTZ_TRIGGERS -GO - -IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[dbo].[FK_QRTZ_SIMPROP_TRIGGERS_QRTZ_TRIGGERS]') AND OBJECTPROPERTY(id, N'ISFOREIGNKEY') = 1) -ALTER TABLE [dbo].[QRTZ_SIMPROP_TRIGGERS] DROP CONSTRAINT FK_QRTZ_SIMPROP_TRIGGERS_QRTZ_TRIGGERS -GO - -IF EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_QRTZ_JOB_LISTENERS_QRTZ_JOB_DETAILS]') AND parent_object_id = OBJECT_ID(N'[dbo].[QRTZ_JOB_LISTENERS]')) -ALTER TABLE [dbo].[QRTZ_JOB_LISTENERS] DROP CONSTRAINT [FK_QRTZ_JOB_LISTENERS_QRTZ_JOB_DETAILS] - -IF EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_QRTZ_TRIGGER_LISTENERS_QRTZ_TRIGGERS]') AND parent_object_id = OBJECT_ID(N'[dbo].[QRTZ_TRIGGER_LISTENERS]')) -ALTER TABLE [dbo].[QRTZ_TRIGGER_LISTENERS] DROP CONSTRAINT [FK_QRTZ_TRIGGER_LISTENERS_QRTZ_TRIGGERS] - - -IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[dbo].[QRTZ_CALENDARS]') AND OBJECTPROPERTY(id, N'ISUSERTABLE') = 1) -DROP TABLE [dbo].[QRTZ_CALENDARS] -GO - -IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[dbo].[QRTZ_CRON_TRIGGERS]') AND OBJECTPROPERTY(id, N'ISUSERTABLE') = 1) -DROP TABLE [dbo].[QRTZ_CRON_TRIGGERS] -GO - -IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[dbo].[QRTZ_BLOB_TRIGGERS]') AND OBJECTPROPERTY(id, N'ISUSERTABLE') = 1) -DROP TABLE [dbo].[QRTZ_BLOB_TRIGGERS] -GO - -IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[dbo].[QRTZ_FIRED_TRIGGERS]') AND OBJECTPROPERTY(id, N'ISUSERTABLE') = 1) -DROP TABLE [dbo].[QRTZ_FIRED_TRIGGERS] -GO - -IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[dbo].[QRTZ_PAUSED_TRIGGER_GRPS]') AND OBJECTPROPERTY(id, N'ISUSERTABLE') = 1) -DROP TABLE [dbo].[QRTZ_PAUSED_TRIGGER_GRPS] -GO - -IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[QRTZ_JOB_LISTENERS]') AND type in (N'U')) -DROP TABLE [dbo].[QRTZ_JOB_LISTENERS] - -IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[dbo].[QRTZ_SCHEDULER_STATE]') AND OBJECTPROPERTY(id, N'ISUSERTABLE') = 1) -DROP TABLE [dbo].[QRTZ_SCHEDULER_STATE] -GO - -IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[dbo].[QRTZ_LOCKS]') AND OBJECTPROPERTY(id, N'ISUSERTABLE') = 1) -DROP TABLE [dbo].[QRTZ_LOCKS] -GO -IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[QRTZ_TRIGGER_LISTENERS]') AND type in (N'U')) -DROP TABLE [dbo].[QRTZ_TRIGGER_LISTENERS] - - -IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[dbo].[QRTZ_JOB_DETAILS]') AND OBJECTPROPERTY(id, N'ISUSERTABLE') = 1) -DROP TABLE [dbo].[QRTZ_JOB_DETAILS] -GO - -IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[dbo].[QRTZ_SIMPLE_TRIGGERS]') AND OBJECTPROPERTY(id, N'ISUSERTABLE') = 1) -DROP TABLE [dbo].[QRTZ_SIMPLE_TRIGGERS] -GO - -IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[dbo].[QRTZ_SIMPROP_TRIGGERS]') AND OBJECTPROPERTY(id, N'ISUSERTABLE') = 1) -DROP TABLE [dbo].QRTZ_SIMPROP_TRIGGERS -GO - -IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[dbo].[QRTZ_TRIGGERS]') AND OBJECTPROPERTY(id, N'ISUSERTABLE') = 1) -DROP TABLE [dbo].[QRTZ_TRIGGERS] -GO - -CREATE TABLE [dbo].[QRTZ_CALENDARS] ( - [SCHED_NAME] [NVARCHAR] (120) NOT NULL , - [CALENDAR_NAME] [NVARCHAR] (200) NOT NULL , - [CALENDAR] [VARBINARY](MAX) NOT NULL -) -GO - -CREATE TABLE [dbo].[QRTZ_CRON_TRIGGERS] ( - [SCHED_NAME] [NVARCHAR] (120) NOT NULL , - [TRIGGER_NAME] [NVARCHAR] (150) NOT NULL , - [TRIGGER_GROUP] [NVARCHAR] (150) NOT NULL , - [CRON_EXPRESSION] [NVARCHAR] (120) NOT NULL , - [TIME_ZONE_ID] [NVARCHAR] (80) -) -GO - -CREATE TABLE [dbo].[QRTZ_FIRED_TRIGGERS] ( - [SCHED_NAME] [NVARCHAR] (120) NOT NULL , - [ENTRY_ID] [NVARCHAR] (140) NOT NULL , - [TRIGGER_NAME] [NVARCHAR] (150) NOT NULL , - [TRIGGER_GROUP] [NVARCHAR] (150) NOT NULL , - [INSTANCE_NAME] [NVARCHAR] (200) NOT NULL , - [FIRED_TIME] [BIGINT] NOT NULL , - [SCHED_TIME] [BIGINT] NOT NULL , - [PRIORITY] [INTEGER] NOT NULL , - [STATE] [NVARCHAR] (16) NOT NULL, - [JOB_NAME] [NVARCHAR] (150) NULL , - [JOB_GROUP] [NVARCHAR] (150) NULL , - [IS_NONCONCURRENT] BIT NULL , - [REQUESTS_RECOVERY] BIT NULL -) -GO - -CREATE TABLE [dbo].[QRTZ_PAUSED_TRIGGER_GRPS] ( - [SCHED_NAME] [NVARCHAR] (120) NOT NULL , - [TRIGGER_GROUP] [NVARCHAR] (150) NOT NULL -) -GO - -CREATE TABLE [dbo].[QRTZ_SCHEDULER_STATE] ( - [SCHED_NAME] [NVARCHAR] (120) NOT NULL , - [INSTANCE_NAME] [NVARCHAR] (200) NOT NULL , - [LAST_CHECKIN_TIME] [BIGINT] NOT NULL , - [CHECKIN_INTERVAL] [BIGINT] NOT NULL -) -GO - -CREATE TABLE [dbo].[QRTZ_LOCKS] ( - [SCHED_NAME] [NVARCHAR] (120) NOT NULL , - [LOCK_NAME] [NVARCHAR] (40) NOT NULL -) -GO - -CREATE TABLE [dbo].[QRTZ_JOB_DETAILS] ( - [SCHED_NAME] [NVARCHAR] (120) NOT NULL , - [JOB_NAME] [NVARCHAR] (150) NOT NULL , - [JOB_GROUP] [NVARCHAR] (150) NOT NULL , - [DESCRIPTION] [NVARCHAR] (250) NULL , - [JOB_CLASS_NAME] [NVARCHAR] (500) NOT NULL , - [IS_DURABLE] BIT NOT NULL , - [IS_NONCONCURRENT] BIT NOT NULL , - [IS_UPDATE_DATA] BIT NOT NULL , - [REQUESTS_RECOVERY] BIT NOT NULL , - [JOB_DATA] [VARBINARY](MAX) NULL -) -GO - -CREATE TABLE [dbo].[QRTZ_SIMPLE_TRIGGERS] ( - [SCHED_NAME] [NVARCHAR] (120) NOT NULL , - [TRIGGER_NAME] [NVARCHAR] (150) NOT NULL , - [TRIGGER_GROUP] [NVARCHAR] (150) NOT NULL , - [REPEAT_COUNT] [INTEGER] NOT NULL , - [REPEAT_INTERVAL] [BIGINT] NOT NULL , - [TIMES_TRIGGERED] [INTEGER] NOT NULL -) -GO - -CREATE TABLE [dbo].[QRTZ_SIMPROP_TRIGGERS] ( - [SCHED_NAME] [NVARCHAR] (120) NOT NULL , - [TRIGGER_NAME] [NVARCHAR] (150) NOT NULL , - [TRIGGER_GROUP] [NVARCHAR] (150) NOT NULL , - [STR_PROP_1] [NVARCHAR] (512) NULL, - [STR_PROP_2] [NVARCHAR] (512) NULL, - [STR_PROP_3] [NVARCHAR] (512) NULL, - [INT_PROP_1] [INT] NULL, - [INT_PROP_2] [INT] NULL, - [LONG_PROP_1] [BIGINT] NULL, - [LONG_PROP_2] [BIGINT] NULL, - [DEC_PROP_1] [NUMERIC] (13,4) NULL, - [DEC_PROP_2] [NUMERIC] (13,4) NULL, - [BOOL_PROP_1] BIT NULL, - [BOOL_PROP_2] BIT NULL, - [TIME_ZONE_ID] [NVARCHAR] (80) NULL -) -GO - -CREATE TABLE [dbo].[QRTZ_BLOB_TRIGGERS] ( - [SCHED_NAME] [NVARCHAR] (120) NOT NULL , - [TRIGGER_NAME] [NVARCHAR] (150) NOT NULL , - [TRIGGER_GROUP] [NVARCHAR] (150) NOT NULL , - [BLOB_DATA] [VARBINARY](MAX) NULL -) -GO - -CREATE TABLE [dbo].[QRTZ_TRIGGERS] ( - [SCHED_NAME] [NVARCHAR] (120) NOT NULL , - [TRIGGER_NAME] [NVARCHAR] (150) NOT NULL , - [TRIGGER_GROUP] [NVARCHAR] (150) NOT NULL , - [JOB_NAME] [NVARCHAR] (150) NOT NULL , - [JOB_GROUP] [NVARCHAR] (150) NOT NULL , - [DESCRIPTION] [NVARCHAR] (250) NULL , - [NEXT_FIRE_TIME] [BIGINT] NULL , - [PREV_FIRE_TIME] [BIGINT] NULL , - [PRIORITY] [INTEGER] NULL , - [TRIGGER_STATE] [NVARCHAR] (16) NOT NULL , - [TRIGGER_TYPE] [NVARCHAR] (8) NOT NULL , - [START_TIME] [BIGINT] NOT NULL , - [END_TIME] [BIGINT] NULL , - [CALENDAR_NAME] [NVARCHAR] (200) NULL , - [MISFIRE_INSTR] [INTEGER] NULL , - [JOB_DATA] [VARBINARY](MAX) NULL -) -GO - -ALTER TABLE [dbo].[QRTZ_CALENDARS] WITH NOCHECK ADD - CONSTRAINT [PK_QRTZ_CALENDARS] PRIMARY KEY CLUSTERED - ( - [SCHED_NAME], - [CALENDAR_NAME] - ) -GO - -ALTER TABLE [dbo].[QRTZ_CRON_TRIGGERS] WITH NOCHECK ADD - CONSTRAINT [PK_QRTZ_CRON_TRIGGERS] PRIMARY KEY CLUSTERED - ( - [SCHED_NAME], - [TRIGGER_NAME], - [TRIGGER_GROUP] - ) -GO - -ALTER TABLE [dbo].[QRTZ_FIRED_TRIGGERS] WITH NOCHECK ADD - CONSTRAINT [PK_QRTZ_FIRED_TRIGGERS] PRIMARY KEY CLUSTERED - ( - [SCHED_NAME], - [ENTRY_ID] - ) -GO - -ALTER TABLE [dbo].[QRTZ_PAUSED_TRIGGER_GRPS] WITH NOCHECK ADD - CONSTRAINT [PK_QRTZ_PAUSED_TRIGGER_GRPS] PRIMARY KEY CLUSTERED - ( - [SCHED_NAME], - [TRIGGER_GROUP] - ) -GO - -ALTER TABLE [dbo].[QRTZ_SCHEDULER_STATE] WITH NOCHECK ADD - CONSTRAINT [PK_QRTZ_SCHEDULER_STATE] PRIMARY KEY CLUSTERED - ( - [SCHED_NAME], - [INSTANCE_NAME] - ) -GO - -ALTER TABLE [dbo].[QRTZ_LOCKS] WITH NOCHECK ADD - CONSTRAINT [PK_QRTZ_LOCKS] PRIMARY KEY CLUSTERED - ( - [SCHED_NAME], - [LOCK_NAME] - ) -GO - -ALTER TABLE [dbo].[QRTZ_JOB_DETAILS] WITH NOCHECK ADD - CONSTRAINT [PK_QRTZ_JOB_DETAILS] PRIMARY KEY CLUSTERED - ( - [SCHED_NAME], - [JOB_NAME], - [JOB_GROUP] - ) -GO - -ALTER TABLE [dbo].[QRTZ_SIMPLE_TRIGGERS] WITH NOCHECK ADD - CONSTRAINT [PK_QRTZ_SIMPLE_TRIGGERS] PRIMARY KEY CLUSTERED - ( - [SCHED_NAME], - [TRIGGER_NAME], - [TRIGGER_GROUP] - ) -GO - -ALTER TABLE [dbo].[QRTZ_SIMPROP_TRIGGERS] WITH NOCHECK ADD - CONSTRAINT [PK_QRTZ_SIMPROP_TRIGGERS] PRIMARY KEY CLUSTERED - ( - [SCHED_NAME], - [TRIGGER_NAME], - [TRIGGER_GROUP] - ) -GO - -ALTER TABLE [dbo].[QRTZ_TRIGGERS] WITH NOCHECK ADD - CONSTRAINT [PK_QRTZ_TRIGGERS] PRIMARY KEY CLUSTERED - ( - [SCHED_NAME], - [TRIGGER_NAME], - [TRIGGER_GROUP] - ) -GO - -ALTER TABLE [dbo].QRTZ_BLOB_TRIGGERS WITH NOCHECK ADD - CONSTRAINT [PK_QRTZ_BLOB_TRIGGERS] PRIMARY KEY CLUSTERED - ( - [SCHED_NAME], - [TRIGGER_NAME], - [TRIGGER_GROUP] - ) -GO - -ALTER TABLE [dbo].[QRTZ_CRON_TRIGGERS] ADD - CONSTRAINT [FK_QRTZ_CRON_TRIGGERS_QRTZ_TRIGGERS] FOREIGN KEY - ( - [SCHED_NAME], - [TRIGGER_NAME], - [TRIGGER_GROUP] - ) REFERENCES [dbo].[QRTZ_TRIGGERS] ( - [SCHED_NAME], - [TRIGGER_NAME], - [TRIGGER_GROUP] - ) ON DELETE CASCADE -GO - -ALTER TABLE [dbo].[QRTZ_SIMPLE_TRIGGERS] ADD - CONSTRAINT [FK_QRTZ_SIMPLE_TRIGGERS_QRTZ_TRIGGERS] FOREIGN KEY - ( - [SCHED_NAME], - [TRIGGER_NAME], - [TRIGGER_GROUP] - ) REFERENCES [dbo].[QRTZ_TRIGGERS] ( - [SCHED_NAME], - [TRIGGER_NAME], - [TRIGGER_GROUP] - ) ON DELETE CASCADE -GO - -ALTER TABLE [dbo].[QRTZ_SIMPROP_TRIGGERS] ADD - CONSTRAINT [FK_QRTZ_SIMPROP_TRIGGERS_QRTZ_TRIGGERS] FOREIGN KEY - ( - [SCHED_NAME], - [TRIGGER_NAME], - [TRIGGER_GROUP] - ) REFERENCES [dbo].[QRTZ_TRIGGERS] ( - [SCHED_NAME], - [TRIGGER_NAME], - [TRIGGER_GROUP] - ) ON DELETE CASCADE -GO - -ALTER TABLE [dbo].[QRTZ_TRIGGERS] ADD - CONSTRAINT [FK_QRTZ_TRIGGERS_QRTZ_JOB_DETAILS] FOREIGN KEY - ( - [SCHED_NAME], - [JOB_NAME], - [JOB_GROUP] - ) REFERENCES [dbo].[QRTZ_JOB_DETAILS] ( - [SCHED_NAME], - [JOB_NAME], - [JOB_GROUP] - ) -GO - -CREATE INDEX IDX_QRTZ_T_J ON QRTZ_TRIGGERS(SCHED_NAME,JOB_NAME,JOB_GROUP) -CREATE INDEX IDX_QRTZ_T_JG ON QRTZ_TRIGGERS(SCHED_NAME,JOB_GROUP) -CREATE INDEX IDX_QRTZ_T_C ON QRTZ_TRIGGERS(SCHED_NAME,CALENDAR_NAME) -CREATE INDEX IDX_QRTZ_T_G ON QRTZ_TRIGGERS(SCHED_NAME,TRIGGER_GROUP) -CREATE INDEX IDX_QRTZ_T_STATE ON QRTZ_TRIGGERS(SCHED_NAME,TRIGGER_STATE) -CREATE INDEX IDX_QRTZ_T_N_STATE ON QRTZ_TRIGGERS(SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP,TRIGGER_STATE) -CREATE INDEX IDX_QRTZ_T_N_G_STATE ON QRTZ_TRIGGERS(SCHED_NAME,TRIGGER_GROUP,TRIGGER_STATE) -CREATE INDEX IDX_QRTZ_T_NEXT_FIRE_TIME ON QRTZ_TRIGGERS(SCHED_NAME,NEXT_FIRE_TIME) -CREATE INDEX IDX_QRTZ_T_NFT_ST ON QRTZ_TRIGGERS(SCHED_NAME,TRIGGER_STATE,NEXT_FIRE_TIME) -CREATE INDEX IDX_QRTZ_T_NFT_MISFIRE ON QRTZ_TRIGGERS(SCHED_NAME,MISFIRE_INSTR,NEXT_FIRE_TIME) -CREATE INDEX IDX_QRTZ_T_NFT_ST_MISFIRE ON QRTZ_TRIGGERS(SCHED_NAME,MISFIRE_INSTR,NEXT_FIRE_TIME,TRIGGER_STATE) -CREATE INDEX IDX_QRTZ_T_NFT_ST_MISFIRE_GRP ON QRTZ_TRIGGERS(SCHED_NAME,MISFIRE_INSTR,NEXT_FIRE_TIME,TRIGGER_GROUP,TRIGGER_STATE) - -CREATE INDEX IDX_QRTZ_FT_TRIG_INST_NAME ON QRTZ_FIRED_TRIGGERS(SCHED_NAME,INSTANCE_NAME) -CREATE INDEX IDX_QRTZ_FT_INST_JOB_REQ_RCVRY ON QRTZ_FIRED_TRIGGERS(SCHED_NAME,INSTANCE_NAME,REQUESTS_RECOVERY) -CREATE INDEX IDX_QRTZ_FT_J_G ON QRTZ_FIRED_TRIGGERS(SCHED_NAME,JOB_NAME,JOB_GROUP) -CREATE INDEX IDX_QRTZ_FT_JG ON QRTZ_FIRED_TRIGGERS(SCHED_NAME,JOB_GROUP) -CREATE INDEX IDX_QRTZ_FT_T_G ON QRTZ_FIRED_TRIGGERS(SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP) -CREATE INDEX IDX_QRTZ_FT_TG ON QRTZ_FIRED_TRIGGERS(SCHED_NAME,TRIGGER_GROUP) -GO \ No newline at end of file From dbd1756c204cf4d6bb4111320d754ce3c02992be Mon Sep 17 00:00:00 2001 From: Necati Meral Date: Fri, 28 Feb 2020 09:49:50 +0100 Subject: [PATCH 26/56] Using `IHttpClientFactory` instead of manually creating a `HttpClient` instance This enables customization of the created client or it's handlers from outside of this module. --- .../Volo.Abp.IdentityModel.csproj | 1 + .../IdentityModelAuthenticationService.cs | 19 +++++++++++-------- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/framework/src/Volo.Abp.IdentityModel/Volo.Abp.IdentityModel.csproj b/framework/src/Volo.Abp.IdentityModel/Volo.Abp.IdentityModel.csproj index 3e4ae78b91..ce26fe7bea 100644 --- a/framework/src/Volo.Abp.IdentityModel/Volo.Abp.IdentityModel.csproj +++ b/framework/src/Volo.Abp.IdentityModel/Volo.Abp.IdentityModel.csproj @@ -16,6 +16,7 @@ + diff --git a/framework/src/Volo.Abp.IdentityModel/Volo/Abp/IdentityModel/IdentityModelAuthenticationService.cs b/framework/src/Volo.Abp.IdentityModel/Volo/Abp/IdentityModel/IdentityModelAuthenticationService.cs index ca6e41d60d..6487f6ce65 100644 --- a/framework/src/Volo.Abp.IdentityModel/Volo/Abp/IdentityModel/IdentityModelAuthenticationService.cs +++ b/framework/src/Volo.Abp.IdentityModel/Volo/Abp/IdentityModel/IdentityModelAuthenticationService.cs @@ -21,12 +21,15 @@ namespace Volo.Abp.IdentityModel public ILogger Logger { get; set; } protected AbpIdentityClientOptions ClientOptions { get; } protected ICancellationTokenProvider CancellationTokenProvider { get; } + protected IHttpClientFactory HttpClientFactory { get; } public IdentityModelAuthenticationService( IOptions options, - ICancellationTokenProvider cancellationTokenProvider) + ICancellationTokenProvider cancellationTokenProvider, + IHttpClientFactory httpClientFactory) { CancellationTokenProvider = cancellationTokenProvider; + HttpClientFactory = httpClientFactory; ClientOptions = options.Value; Logger = NullLogger.Instance; } @@ -95,7 +98,7 @@ namespace Volo.Abp.IdentityModel protected virtual async Task GetDiscoveryResponse( IdentityClientConfiguration configuration) { - using (var httpClient = new HttpClient()) + using (var httpClient = HttpClientFactory.CreateClient()) { return await httpClient.GetDiscoveryDocumentAsync(new DiscoveryDocumentRequest { @@ -109,10 +112,10 @@ namespace Volo.Abp.IdentityModel } protected virtual async Task GetTokenResponse( - DiscoveryDocumentResponse discoveryResponse, + DiscoveryDocumentResponse discoveryResponse, IdentityClientConfiguration configuration) { - using (var httpClient = new HttpClient()) + using (var httpClient = HttpClientFactory.CreateClient()) { switch (configuration.GrantType) { @@ -134,7 +137,7 @@ namespace Volo.Abp.IdentityModel protected virtual Task CreatePasswordTokenRequestAsync(DiscoveryDocumentResponse discoveryResponse, IdentityClientConfiguration configuration) { - var request = new PasswordTokenRequest + var request = new PasswordTokenRequest { Address = discoveryResponse.TokenEndpoint, Scope = configuration.Scope, @@ -149,11 +152,11 @@ namespace Volo.Abp.IdentityModel return Task.FromResult(request); } - protected virtual Task CreateClientCredentialsTokenRequestAsync( - DiscoveryDocumentResponse discoveryResponse, + protected virtual Task CreateClientCredentialsTokenRequestAsync( + DiscoveryDocumentResponse discoveryResponse, IdentityClientConfiguration configuration) { - var request = new ClientCredentialsTokenRequest + var request = new ClientCredentialsTokenRequest { Address = discoveryResponse.TokenEndpoint, Scope = configuration.Scope, From fb3d870459f3ad534bb47ecd156647367e60f7e1 Mon Sep 17 00:00:00 2001 From: liangshiwei Date: Fri, 28 Feb 2020 20:02:57 +0800 Subject: [PATCH 27/56] Make worker and workermanager lifecycles singletons by default --- .../Quartz/AbpBackgroundWorkersQuartzModule.cs | 14 +++++--------- .../Quartz/AbpQuartzConventionalRegistrar.cs | 13 ++++++++++--- .../Quartz/QuartzBackgroundWorkerManager.cs | 3 ++- 3 files changed, 17 insertions(+), 13 deletions(-) diff --git a/framework/src/Volo.Abp.BackgroundWorkers.Quartz/Volo/Abp/BackgroundWorkers/Quartz/AbpBackgroundWorkersQuartzModule.cs b/framework/src/Volo.Abp.BackgroundWorkers.Quartz/Volo/Abp/BackgroundWorkers/Quartz/AbpBackgroundWorkersQuartzModule.cs index bf7e091e7b..1f23b350aa 100644 --- a/framework/src/Volo.Abp.BackgroundWorkers.Quartz/Volo/Abp/BackgroundWorkers/Quartz/AbpBackgroundWorkersQuartzModule.cs +++ b/framework/src/Volo.Abp.BackgroundWorkers.Quartz/Volo/Abp/BackgroundWorkers/Quartz/AbpBackgroundWorkersQuartzModule.cs @@ -14,20 +14,16 @@ namespace Volo.Abp.BackgroundWorkers.Quartz public override void PreConfigureServices(ServiceConfigurationContext context) { context.Services.AddConventionalRegistrar(new AbpQuartzConventionalRegistrar()); - context.Services.Replace(ServiceDescriptor.Transient()); } public override void OnApplicationInitialization(ApplicationInitializationContext context) { - using (var scope = context.ServiceProvider.CreateScope()) - { - var backgroundWorkerManager = scope.ServiceProvider.GetService(); - var works = scope.ServiceProvider.GetServices(); + var backgroundWorkerManager = context.ServiceProvider.GetService(); + var works = context.ServiceProvider.GetServices(); - foreach (var work in works) - { - backgroundWorkerManager.Add(work); - } + foreach (var work in works) + { + backgroundWorkerManager.Add(work); } } } diff --git a/framework/src/Volo.Abp.BackgroundWorkers.Quartz/Volo/Abp/BackgroundWorkers/Quartz/AbpQuartzConventionalRegistrar.cs b/framework/src/Volo.Abp.BackgroundWorkers.Quartz/Volo/Abp/BackgroundWorkers/Quartz/AbpQuartzConventionalRegistrar.cs index 5546c056fd..8d709c449c 100644 --- a/framework/src/Volo.Abp.BackgroundWorkers.Quartz/Volo/Abp/BackgroundWorkers/Quartz/AbpQuartzConventionalRegistrar.cs +++ b/framework/src/Volo.Abp.BackgroundWorkers.Quartz/Volo/Abp/BackgroundWorkers/Quartz/AbpQuartzConventionalRegistrar.cs @@ -4,7 +4,7 @@ using Volo.Abp.DependencyInjection; namespace Volo.Abp.BackgroundWorkers.Quartz { - public class AbpQuartzConventionalRegistrar : ConventionalRegistrarBase + public class AbpQuartzConventionalRegistrar : DefaultConventionalRegistrar { public override void AddType(IServiceCollection services, Type type) { @@ -13,8 +13,15 @@ namespace Volo.Abp.BackgroundWorkers.Quartz return; } - services.AddTransient(typeof(IQuartzBackgroundWorker), type); - services.AddTransient(type); + var dependencyAttribute = GetDependencyAttributeOrNull(type); + var lifeTime = GetLifeTimeOrNull(type, dependencyAttribute); + + if (lifeTime == null) + { + return; + } + + services.Add(ServiceDescriptor.Describe(typeof(IQuartzBackgroundWorker), type, lifeTime.Value)); } } } diff --git a/framework/src/Volo.Abp.BackgroundWorkers.Quartz/Volo/Abp/BackgroundWorkers/Quartz/QuartzBackgroundWorkerManager.cs b/framework/src/Volo.Abp.BackgroundWorkers.Quartz/Volo/Abp/BackgroundWorkers/Quartz/QuartzBackgroundWorkerManager.cs index 3fbdfd7ba7..46568a5a11 100644 --- a/framework/src/Volo.Abp.BackgroundWorkers.Quartz/Volo/Abp/BackgroundWorkers/Quartz/QuartzBackgroundWorkerManager.cs +++ b/framework/src/Volo.Abp.BackgroundWorkers.Quartz/Volo/Abp/BackgroundWorkers/Quartz/QuartzBackgroundWorkerManager.cs @@ -6,7 +6,8 @@ using Volo.Abp.Threading; namespace Volo.Abp.BackgroundWorkers.Quartz { - public class QuartzBackgroundWorkerManager : IBackgroundWorkerManager, ITransientDependency + [Dependency(ReplaceServices = true)] + public class QuartzBackgroundWorkerManager : IBackgroundWorkerManager, ISingletonDependency { private readonly IScheduler _scheduler; From 32e9679a7a361817d12af828f47f833e15044ea5 Mon Sep 17 00:00:00 2001 From: liangshiwei Date: Fri, 28 Feb 2020 21:17:19 +0800 Subject: [PATCH 28/56] remove backgroundjobs demo app fody --- .../FodyWeavers.xml | 3 -- .../FodyWeavers.xsd | 30 ------------------- ...Abp.BackgroundJobs.DemoApp.HangFire.csproj | 4 +-- .../FodyWeavers.xml | 3 -- .../FodyWeavers.xsd | 30 ------------------- ...o.Abp.BackgroundJobs.DemoApp.Quartz.csproj | 2 -- .../FodyWeavers.xml | 3 -- .../FodyWeavers.xsd | 30 ------------------- ...Abp.BackgroundJobs.DemoApp.RabbitMq.csproj | 4 +-- .../FodyWeavers.xml | 3 -- .../FodyWeavers.xsd | 30 ------------------- .../Volo.Abp.BackgroundJobs.DemoApp.csproj | 4 +-- nupkg/common.ps1 | 2 ++ 13 files changed, 5 insertions(+), 143 deletions(-) delete mode 100644 modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.HangFire/FodyWeavers.xml delete mode 100644 modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.HangFire/FodyWeavers.xsd delete mode 100644 modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.Quartz/FodyWeavers.xml delete mode 100644 modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.Quartz/FodyWeavers.xsd delete mode 100644 modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.RabbitMq/FodyWeavers.xml delete mode 100644 modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.RabbitMq/FodyWeavers.xsd delete mode 100644 modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp/FodyWeavers.xml delete mode 100644 modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp/FodyWeavers.xsd diff --git a/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.HangFire/FodyWeavers.xml b/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.HangFire/FodyWeavers.xml deleted file mode 100644 index be0de3a908..0000000000 --- a/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.HangFire/FodyWeavers.xml +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file diff --git a/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.HangFire/FodyWeavers.xsd b/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.HangFire/FodyWeavers.xsd deleted file mode 100644 index 3f3946e282..0000000000 --- a/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.HangFire/FodyWeavers.xsd +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - - - - - - - - '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/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.HangFire/Volo.Abp.BackgroundJobs.DemoApp.HangFire.csproj b/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.HangFire/Volo.Abp.BackgroundJobs.DemoApp.HangFire.csproj index f27272bd28..3490b31f67 100644 --- a/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.HangFire/Volo.Abp.BackgroundJobs.DemoApp.HangFire.csproj +++ b/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.HangFire/Volo.Abp.BackgroundJobs.DemoApp.HangFire.csproj @@ -1,6 +1,4 @@ - - - + Exe diff --git a/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.Quartz/FodyWeavers.xml b/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.Quartz/FodyWeavers.xml deleted file mode 100644 index 00e1d9a1c1..0000000000 --- a/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.Quartz/FodyWeavers.xml +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file diff --git a/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.Quartz/FodyWeavers.xsd b/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.Quartz/FodyWeavers.xsd deleted file mode 100644 index 3f3946e282..0000000000 --- a/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.Quartz/FodyWeavers.xsd +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - - - - - - - - '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/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.Quartz/Volo.Abp.BackgroundJobs.DemoApp.Quartz.csproj b/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.Quartz/Volo.Abp.BackgroundJobs.DemoApp.Quartz.csproj index 3920a454a3..5c65d7555a 100644 --- a/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.Quartz/Volo.Abp.BackgroundJobs.DemoApp.Quartz.csproj +++ b/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.Quartz/Volo.Abp.BackgroundJobs.DemoApp.Quartz.csproj @@ -1,7 +1,5 @@  - - Exe netcoreapp3.1 diff --git a/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.RabbitMq/FodyWeavers.xml b/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.RabbitMq/FodyWeavers.xml deleted file mode 100644 index be0de3a908..0000000000 --- a/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.RabbitMq/FodyWeavers.xml +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file diff --git a/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.RabbitMq/FodyWeavers.xsd b/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.RabbitMq/FodyWeavers.xsd deleted file mode 100644 index 3f3946e282..0000000000 --- a/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.RabbitMq/FodyWeavers.xsd +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - - - - - - - - '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/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.RabbitMq/Volo.Abp.BackgroundJobs.DemoApp.RabbitMq.csproj b/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.RabbitMq/Volo.Abp.BackgroundJobs.DemoApp.RabbitMq.csproj index 460716fb26..adcf9be1aa 100644 --- a/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.RabbitMq/Volo.Abp.BackgroundJobs.DemoApp.RabbitMq.csproj +++ b/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.RabbitMq/Volo.Abp.BackgroundJobs.DemoApp.RabbitMq.csproj @@ -1,6 +1,4 @@ - - - + Exe diff --git a/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp/FodyWeavers.xml b/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp/FodyWeavers.xml deleted file mode 100644 index be0de3a908..0000000000 --- a/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp/FodyWeavers.xml +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file diff --git a/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp/FodyWeavers.xsd b/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp/FodyWeavers.xsd deleted file mode 100644 index 3f3946e282..0000000000 --- a/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp/FodyWeavers.xsd +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - - - - - - - - '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/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp/Volo.Abp.BackgroundJobs.DemoApp.csproj b/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp/Volo.Abp.BackgroundJobs.DemoApp.csproj index 6c9c118af4..b3bc53a2ed 100644 --- a/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp/Volo.Abp.BackgroundJobs.DemoApp.csproj +++ b/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp/Volo.Abp.BackgroundJobs.DemoApp.csproj @@ -1,6 +1,4 @@ - - - + Exe diff --git a/nupkg/common.ps1 b/nupkg/common.ps1 index a582f8c115..812f822108 100644 --- a/nupkg/common.ps1 +++ b/nupkg/common.ps1 @@ -50,7 +50,9 @@ $projects = ( "framework/src/Volo.Abp.BackgroundJobs", "framework/src/Volo.Abp.BackgroundJobs.HangFire", "framework/src/Volo.Abp.BackgroundJobs.RabbitMQ", + "framework/src/Volo.Abp.BackgroundJobs.Quartz", "framework/src/Volo.Abp.BackgroundWorkers", + "framework/src/Volo.Abp.BackgroundWorkers.Quartz", "framework/src/Volo.Abp.Caching", "framework/src/Volo.Abp.Castle.Core", "framework/src/Volo.Abp.Cli.Core", From d5b7f72272d025455f4221a96700756281876372 Mon Sep 17 00:00:00 2001 From: liangshiwei Date: Fri, 28 Feb 2020 21:20:58 +0800 Subject: [PATCH 29/56] Delete demo app appsettings --- .../Volo.Abp.BackgroundJobs.DemoApp.Quartz.csproj | 6 ------ .../Volo.Abp.BackgroundJobs.DemoApp.Quartz/appsettings.json | 5 ----- 2 files changed, 11 deletions(-) delete mode 100644 modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.Quartz/appsettings.json diff --git a/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.Quartz/Volo.Abp.BackgroundJobs.DemoApp.Quartz.csproj b/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.Quartz/Volo.Abp.BackgroundJobs.DemoApp.Quartz.csproj index 5c65d7555a..7bd70093ee 100644 --- a/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.Quartz/Volo.Abp.BackgroundJobs.DemoApp.Quartz.csproj +++ b/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.Quartz/Volo.Abp.BackgroundJobs.DemoApp.Quartz.csproj @@ -15,10 +15,4 @@ - - - Always - - - diff --git a/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.Quartz/appsettings.json b/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.Quartz/appsettings.json deleted file mode 100644 index e1e6966497..0000000000 --- a/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.Quartz/appsettings.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "ConnectionStrings": { - "Default": "Server=localhost;Database=BackgroundJobsDemoApp;Trusted_Connection=True;MultipleActiveResultSets=true" - } -} \ No newline at end of file From 484f0bc08ce2f795bbb873efacd67baa846ce9dd Mon Sep 17 00:00:00 2001 From: liangshiwei Date: Mon, 2 Mar 2020 15:45:06 +0800 Subject: [PATCH 30/56] Allow CLI to generate templates with custom sources --- .../Volo/Abp/Cli/Commands/GetSourceCommand.cs | 1 + .../Volo/Abp/Cli/Commands/NewCommand.cs | 18 +++++++- .../ProjectBuilding/AbpIoSourceCodeStore.cs | 42 ++++++++++++++----- .../Cli/ProjectBuilding/ISourceCodeStore.cs | 3 +- .../Cli/ProjectBuilding/ProjectBuildArgs.cs | 7 +++- .../ProjectBuilding/TemplateProjectBuilder.cs | 15 +++---- 6 files changed, 65 insertions(+), 21 deletions(-) diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/GetSourceCommand.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/GetSourceCommand.cs index 9ad7eb5b49..175ce84fb3 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/GetSourceCommand.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/GetSourceCommand.cs @@ -78,6 +78,7 @@ namespace Volo.Abp.Cli.Commands UiFramework.NotSpecified, MobileApp.None, gitHubLocalRepositoryPath, + null, commandLineArgs.Options ) ); diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/NewCommand.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/NewCommand.cs index d39a333860..050ee4b51f 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/NewCommand.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/NewCommand.cs @@ -30,7 +30,7 @@ namespace Volo.Abp.Cli.Commands public async Task ExecuteAsync(CommandLineArgs commandLineArgs) { var projectName = NamespaceHelper.NormalizeNamespace(commandLineArgs.Target); - + if (projectName == null) { throw new CliUsageException( @@ -39,7 +39,7 @@ namespace Volo.Abp.Cli.Commands GetUsageInfo() ); } - + Logger.LogInformation("Creating your project..."); Logger.LogInformation("Project name: " + projectName); @@ -79,6 +79,12 @@ namespace Volo.Abp.Cli.Commands Logger.LogInformation("GitHub Local Repository Path: " + gitHubLocalRepositoryPath); } + var templateSource = commandLineArgs.Options.GetOrNull(Options.TemplateSource.Long); + if (templateSource != null) + { + Logger.LogInformation("Template Source: " + templateSource); + } + var outputFolder = commandLineArgs.Options.GetOrNull(Options.OutputFolder.Short, Options.OutputFolder.Long); outputFolder = Path.Combine(outputFolder != null ? Path.GetFullPath(outputFolder) : Directory.GetCurrentDirectory(), @@ -102,6 +108,7 @@ namespace Volo.Abp.Cli.Commands uiFramework, mobileApp, gitHubLocalRepositoryPath, + templateSource, commandLineArgs.Options ) ); @@ -162,6 +169,7 @@ namespace Volo.Abp.Cli.Commands sb.AppendLine("--no-ui (if supported by the template)"); sb.AppendLine("--separate-identity-server (if supported by the template)"); sb.AppendLine("--local-framework-ref --abp-path (keeps local references to projects instead of replacing with NuGet package references)"); + sb.AppendLine("--template-source (your local or network abp template source)"); sb.AppendLine(""); sb.AppendLine("Examples:"); sb.AppendLine(""); @@ -174,6 +182,7 @@ namespace Volo.Abp.Cli.Commands sb.AppendLine(" abp new Acme.BookStore -t module"); sb.AppendLine(" abp new Acme.BookStore -t module --no-ui"); sb.AppendLine(" abp new Acme.BookStore --local-framework-ref --abp-path \"D:\\github\\abp\""); + sb.AppendLine(" abp new Acme.BookStore --template-url \"D:\\localTemplate\\abp\""); sb.AppendLine(""); sb.AppendLine("See the documentation for more info: https://docs.abp.io/en/abp/latest/CLI"); @@ -271,6 +280,11 @@ namespace Volo.Abp.Cli.Commands public const string Short = "m"; public const string Long = "mobile"; } + + public static class TemplateSource + { + public const string Long = "template-source"; + } } } } diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/AbpIoSourceCodeStore.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/AbpIoSourceCodeStore.cs index fd0a0e5246..03504251f5 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/AbpIoSourceCodeStore.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/AbpIoSourceCodeStore.cs @@ -2,9 +2,7 @@ using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging.Abstractions; using Microsoft.Extensions.Options; using System; -using System.Collections.Generic; using System.IO; -using System.Linq; using System.Net.Http; using System.Text; using System.Threading.Tasks; @@ -46,7 +44,8 @@ namespace Volo.Abp.Cli.ProjectBuilding public async Task GetAsync( string name, string type, - string version = null) + string version = null, + string templateSource = null) { var latestVersion = await GetLatestSourceCodeVersionAsync(name, type); @@ -57,8 +56,14 @@ namespace Volo.Abp.Cli.ProjectBuilding DirectoryHelper.CreateIfNotExists(CliPaths.TemplateCache); + if (!string.IsNullOrWhiteSpace(templateSource) && !IsNetworkSource(templateSource)) + { + Logger.LogInformation("Using local " + type + ": " + name + ", version: " + version); + return new TemplateFile(File.ReadAllBytes(Path.Combine(templateSource, name + "-" + version + ".zip")), version, latestVersion); + } + var localCacheFile = Path.Combine(CliPaths.TemplateCache, name + "-" + version + ".zip"); - if (Options.CacheTemplates && File.Exists(localCacheFile)) + if (Options.CacheTemplates && File.Exists(localCacheFile) && templateSource.IsNullOrWhiteSpace()) { Logger.LogInformation("Using cached " + type + ": " + name + ", version: " + version); return new TemplateFile(File.ReadAllBytes(localCacheFile), version, latestVersion); @@ -71,11 +76,12 @@ namespace Volo.Abp.Cli.ProjectBuilding { Name = name, Type = type, + TemplateSource = templateSource, Version = version } ); - if (Options.CacheTemplates) + if (Options.CacheTemplates && templateSource.IsNullOrWhiteSpace()) { File.WriteAllBytes(localCacheFile, fileContent); } @@ -114,11 +120,20 @@ namespace Volo.Abp.Cli.ProjectBuilding using (var client = new CliHttpClient(TimeSpan.FromMinutes(10))) { - var responseMessage = await client.PostAsync( - $"{CliUrls.WwwAbpIo}api/download/{input.Type}/", - new StringContent(postData, Encoding.UTF8, MimeTypes.Application.Json), - CancellationTokenProvider.Token - ); + HttpResponseMessage responseMessage; + + if (input.TemplateSource.IsNullOrWhiteSpace()) + { + responseMessage = await client.PostAsync( + $"{CliUrls.WwwAbpIo}api/download/{input.Type}/", + new StringContent(postData, Encoding.UTF8, MimeTypes.Application.Json), + CancellationTokenProvider.Token + ); + } + else + { + responseMessage = await client.GetAsync(input.TemplateSource, CancellationTokenProvider.Token); + } await RemoteServiceExceptionHandler.EnsureSuccessfulHttpResponseAsync(responseMessage); @@ -126,6 +141,11 @@ namespace Volo.Abp.Cli.ProjectBuilding } } + private bool IsNetworkSource(string source) + { + return source.ToLower().StartsWith("http"); + } + public class SourceCodeDownloadInputDto { public string Name { get; set; } @@ -133,6 +153,8 @@ namespace Volo.Abp.Cli.ProjectBuilding public string Version { get; set; } public string Type { get; set; } + + public string TemplateSource { get; set; } } public class GetLatestSourceCodeVersionDto diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/ISourceCodeStore.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/ISourceCodeStore.cs index 4d1ed7aa0c..de082d4bcf 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/ISourceCodeStore.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/ISourceCodeStore.cs @@ -8,7 +8,8 @@ namespace Volo.Abp.Cli.ProjectBuilding Task GetAsync( string name, string type, - [CanBeNull] string version = null + [CanBeNull] string version = null, + [CanBeNull] string templateSource = null ); } } \ No newline at end of file diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/ProjectBuildArgs.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/ProjectBuildArgs.cs index bb20c19e80..2f79f330e5 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/ProjectBuildArgs.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/ProjectBuildArgs.cs @@ -24,17 +24,21 @@ namespace Volo.Abp.Cli.ProjectBuilding [CanBeNull] public string AbpGitHubLocalRepositoryPath { get; set; } + [CanBeNull] + public string TemplateSource { get; set; } + [NotNull] public Dictionary ExtraProperties { get; set; } public ProjectBuildArgs( - [NotNull] SolutionName solutionName, + [NotNull] SolutionName solutionName, [CanBeNull] string templateName = null, [CanBeNull] string version = null, DatabaseProvider databaseProvider = DatabaseProvider.NotSpecified, UiFramework uiFramework = UiFramework.NotSpecified, MobileApp mobileApp = MobileApp.ReactNative, [CanBeNull] string abpGitHubLocalRepositoryPath = null, + [CanBeNull] string templateSource = null, Dictionary extraProperties = null) { SolutionName = Check.NotNull(solutionName, nameof(solutionName)); @@ -44,6 +48,7 @@ namespace Volo.Abp.Cli.ProjectBuilding UiFramework = uiFramework; MobileApp = mobileApp; AbpGitHubLocalRepositoryPath = abpGitHubLocalRepositoryPath; + TemplateSource = templateSource; ExtraProperties = extraProperties ?? new Dictionary(); } } diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/TemplateProjectBuilder.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/TemplateProjectBuilder.cs index 80a25660fc..a0f156de7b 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/TemplateProjectBuilder.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/TemplateProjectBuilder.cs @@ -24,11 +24,11 @@ namespace Volo.Abp.Cli.ProjectBuilding protected IJsonSerializer JsonSerializer { get; } protected IApiKeyService ApiKeyService { get; } - public TemplateProjectBuilder(ISourceCodeStore sourceCodeStore, + public TemplateProjectBuilder(ISourceCodeStore sourceCodeStore, ITemplateInfoProvider templateInfoProvider, - ICliAnalyticsCollect cliAnalyticsCollect, + ICliAnalyticsCollect cliAnalyticsCollect, IOptions options, - IJsonSerializer jsonSerializer, + IJsonSerializer jsonSerializer, IApiKeyService apiKeyService) { SourceCodeStore = sourceCodeStore; @@ -40,7 +40,7 @@ namespace Volo.Abp.Cli.ProjectBuilding Logger = NullLogger.Instance; } - + public async Task BuildAsync(ProjectBuildArgs args) { var templateInfo = GetTemplateInfo(args); @@ -50,9 +50,10 @@ namespace Volo.Abp.Cli.ProjectBuilding var templateFile = await SourceCodeStore.GetAsync( args.TemplateName, SourceCodeTypes.Template, - args.Version + args.Version, + args.TemplateSource ); - + var apiKeyResult = await ApiKeyService.GetApiKeyOrNullAsync(); if (apiKeyResult?.ApiKey != null) { @@ -82,7 +83,7 @@ namespace Volo.Abp.Cli.ProjectBuilding var options = args.ExtraProperties .Where(x => !x.Key.Equals(CliConsts.Command, StringComparison.InvariantCultureIgnoreCase)) .Where(x => !x.Key.Equals("tiered", StringComparison.InvariantCultureIgnoreCase)) - .Where(x => !x.Key.Equals(NewCommand.Options.DatabaseProvider.Long, StringComparison.InvariantCultureIgnoreCase) && + .Where(x => !x.Key.Equals(NewCommand.Options.DatabaseProvider.Long, StringComparison.InvariantCultureIgnoreCase) && !x.Key.Equals(NewCommand.Options.DatabaseProvider.Short, StringComparison.InvariantCultureIgnoreCase)) .Where(x => !x.Key.Equals(NewCommand.Options.OutputFolder.Long, StringComparison.InvariantCultureIgnoreCase) && !x.Key.Equals(NewCommand.Options.OutputFolder.Short, StringComparison.InvariantCultureIgnoreCase)) From 78d6831efa7b0b8e0bbedc20ada83cf3879081ec Mon Sep 17 00:00:00 2001 From: maliming Date: Mon, 2 Mar 2020 16:21:23 +0800 Subject: [PATCH 31/56] Check scope is null or empty. --- .../Pages/Consent.cshtml | 6 +++--- .../Pages/Consent.cshtml.cs | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/account/src/Volo.Abp.Account.Web.IdentityServer/Pages/Consent.cshtml b/modules/account/src/Volo.Abp.Account.Web.IdentityServer/Pages/Consent.cshtml index fa3efda621..b61ad00152 100644 --- a/modules/account/src/Volo.Abp.Account.Web.IdentityServer/Pages/Consent.cshtml +++ b/modules/account/src/Volo.Abp.Account.Web.IdentityServer/Pages/Consent.cshtml @@ -1,4 +1,4 @@ -@page +@page @using Volo.Abp.Account.Web.Pages @using Volo.Abp.Account.Web.Pages.Account @model ConsentModel @@ -25,7 +25,7 @@
    Uncheck the permissions you do not wish to grant.
    - @if (Model.ConsentInput.IdentityScopes.Any()) + @if (!Model.ConsentInput.IdentityScopes.IsNullOrEmpty()) {

    Personal Information

    @@ -55,7 +55,7 @@ } - @if (Model.ConsentInput.ApiScopes.Any()) + @if (!Model.ConsentInput.ApiScopes.IsNullOrEmpty()) {

    Application Access

    diff --git a/modules/account/src/Volo.Abp.Account.Web.IdentityServer/Pages/Consent.cshtml.cs b/modules/account/src/Volo.Abp.Account.Web.IdentityServer/Pages/Consent.cshtml.cs index c583005188..2df177b620 100644 --- a/modules/account/src/Volo.Abp.Account.Web.IdentityServer/Pages/Consent.cshtml.cs +++ b/modules/account/src/Volo.Abp.Account.Web.IdentityServer/Pages/Consent.cshtml.cs @@ -106,7 +106,7 @@ namespace Volo.Abp.Account.Web.Pages } else { - if (ConsentInput.IdentityScopes.Any() || ConsentInput.ApiScopes.Any()) + if (!ConsentInput.IdentityScopes.IsNullOrEmpty() || !ConsentInput.ApiScopes.IsNullOrEmpty()) { grantedConsent = new ConsentResponse { From 8889d62207fd52013ceed4e48aa131db162e664f Mon Sep 17 00:00:00 2001 From: Yunus Emre Kalkan Date: Mon, 2 Mar 2020 11:35:25 +0300 Subject: [PATCH 32/56] ProjectBuildArgs mobileApp nullable --- .../Abp/Cli/Commands/Services/SourceCodeDownloadService.cs | 1 + .../Volo/Abp/Cli/ProjectBuilding/ProjectBuildArgs.cs | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/Services/SourceCodeDownloadService.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/Services/SourceCodeDownloadService.cs index 1055b43f61..c8c6c0453c 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/Services/SourceCodeDownloadService.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/Services/SourceCodeDownloadService.cs @@ -38,6 +38,7 @@ namespace Volo.Abp.Cli.Commands.Services version, DatabaseProvider.NotSpecified, UiFramework.NotSpecified, + null, gitHubLocalRepositoryPath, options ) diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/ProjectBuildArgs.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/ProjectBuildArgs.cs index bb20c19e80..4a6a2fbe9d 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/ProjectBuildArgs.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/ProjectBuildArgs.cs @@ -19,7 +19,7 @@ namespace Volo.Abp.Cli.ProjectBuilding public UiFramework UiFramework { get; set; } - public MobileApp MobileApp { get; set; } + public MobileApp? MobileApp { get; set; } [CanBeNull] public string AbpGitHubLocalRepositoryPath { get; set; } @@ -33,7 +33,7 @@ namespace Volo.Abp.Cli.ProjectBuilding [CanBeNull] string version = null, DatabaseProvider databaseProvider = DatabaseProvider.NotSpecified, UiFramework uiFramework = UiFramework.NotSpecified, - MobileApp mobileApp = MobileApp.ReactNative, + MobileApp? mobileApp = null, [CanBeNull] string abpGitHubLocalRepositoryPath = null, Dictionary extraProperties = null) { From f1e863cc764837edb59805e423361a0105a2002e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?= Date: Mon, 2 Mar 2020 11:43:16 +0300 Subject: [PATCH 33/56] Update CLI.md --- docs/en/CLI.md | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/docs/en/CLI.md b/docs/en/CLI.md index 2c20e37f70..7dccf4ee6d 100644 --- a/docs/en/CLI.md +++ b/docs/en/CLI.md @@ -128,16 +128,24 @@ abp update [options] * `--npm`: Only updates NPM packages. * `--nuget`: Only updates NuGet packages. -### Switch to nightly build (preview) packages +### switch-to-preview -To switch your project to latest preview version of ABP framework, you can use this command. +You can use this command to switch your project to latest preview version of the ABP framework packages. Usage: ````bash abp switch-to-preview [options] ```` -You can also switch back to stable version using: +#### Options + +`--solution-path` or `-sp`: Specifies the solution (.sln) file path. If not specified, CLI tries to find a .sln file in the current directory. + +### switch-to-stable + +If you're using the ABP Framework preview packages, you can switch back to stable version using this command. + +Usage: ````bash abp switch-to-stable [options] @@ -148,7 +156,7 @@ abp switch-to-stable [options] ### login -Some features of the CLI requires to be logged in to abp.io platform. To login with your username write +Some features of the CLI requires to be logged in to abp.io platform. To login with your username write: ```bash abp login From da72bb1ca0a33e866f8a1c2d0d062f961453552e Mon Sep 17 00:00:00 2001 From: liangshiwei Date: Mon, 2 Mar 2020 16:51:29 +0800 Subject: [PATCH 34/56] Fix CIL merge error --- .../Volo/Abp/Cli/Commands/Services/SourceCodeDownloadService.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/Services/SourceCodeDownloadService.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/Services/SourceCodeDownloadService.cs index 1055b43f61..7bb375db93 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/Services/SourceCodeDownloadService.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/Services/SourceCodeDownloadService.cs @@ -38,7 +38,9 @@ namespace Volo.Abp.Cli.Commands.Services version, DatabaseProvider.NotSpecified, UiFramework.NotSpecified, + MobileApp.None, gitHubLocalRepositoryPath, + null, options ) ); From 8794a8c8ee253bee003c9e31bac84f02ec5c62bb Mon Sep 17 00:00:00 2001 From: maliming Date: Mon, 2 Mar 2020 16:51:47 +0800 Subject: [PATCH 35/56] Remove middleware filtering code. --- .../Abp/AspNetCore/Auditing/AbpAuditingMiddleware.cs | 9 --------- 1 file changed, 9 deletions(-) diff --git a/framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/Auditing/AbpAuditingMiddleware.cs b/framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/Auditing/AbpAuditingMiddleware.cs index 10bc9545d7..d3f261a3f7 100644 --- a/framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/Auditing/AbpAuditingMiddleware.cs +++ b/framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/Auditing/AbpAuditingMiddleware.cs @@ -2,8 +2,6 @@ using System; using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Http; -using Microsoft.AspNetCore.Mvc.Abstractions; -using Microsoft.AspNetCore.Mvc.Controllers; using Microsoft.Extensions.Options; using Volo.Abp.Auditing; using Volo.Abp.DependencyInjection; @@ -64,13 +62,6 @@ namespace Volo.Abp.AspNetCore.Auditing return false; } - var endpoint = httpContext.GetEndpoint(); - var actionDescriptor = endpoint?.Metadata.GetMetadata(); - if (!(actionDescriptor is ControllerActionDescriptor)) - { - return false; - } - if (Options.AlwaysLogOnException && hasError) { return true; From 9cccf1ee836eb497e43bb575614e96247b9b7792 Mon Sep 17 00:00:00 2001 From: liangshiwei Date: Mon, 2 Mar 2020 17:29:58 +0800 Subject: [PATCH 36/56] Update CLI.md --- docs/en/CLI.md | 1 + docs/zh-Hans/CLI.md | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/docs/en/CLI.md b/docs/en/CLI.md index 7dccf4ee6d..d5c1565499 100644 --- a/docs/en/CLI.md +++ b/docs/en/CLI.md @@ -55,6 +55,7 @@ abp new Acme.BookStore * `--no-ui`: Specifies to not include the UI. This makes possible to create service-only modules (a.k.a. microservices - without UI). * `--output-folder` or `-o`: Specifies the output folder. Default value is the current directory. * `--version` or `-v`: Specifies the ABP & template version. It can be a [release tag](https://github.com/abpframework/abp/releases) or a [branch name](https://github.com/abpframework/abp/branches). Uses the latest release if not specified. Most of the times, you will want to use the latest version. +* `--template-source`: Specifies a custom template source to use to build the project. Local and network sources can be used(Like `D\localTemplate` or `https://.zip`). ### add-package diff --git a/docs/zh-Hans/CLI.md b/docs/zh-Hans/CLI.md index 863c061209..41332d4fcd 100644 --- a/docs/zh-Hans/CLI.md +++ b/docs/zh-Hans/CLI.md @@ -43,7 +43,7 @@ abp new Acme.BookStore * `app` (default): [应用程序模板](Startup-Templates/Application.md). 其他选项: * `--ui` 或者 `-u`: 指定ui框架.默认`mvc`框架.其他选项: * `mvc`: ASP.NET Core MVC.此模板的其他选项: - * `--tiered`: 创建分层解决方案,Web和Http Api层在物理上是分开的.如果未指定会创建一个分层的解决方案,此解决方案没有那么复杂,适合大多数场景. + * `--tiered`: 创建分层解决方案,Web和Http Api层在物理上是分开的.如果未指定会创建一个分层的解决方案,此解决方案没有那么复杂,适合大多数场景. * `angular`: Angular. 这个模板还有一些额外的选项: * `--separate-identity-server`: 将Identity Server应用程序与API host应用程序分开. 如果未指定,则服务器端将只有一个端点. * `none`: 无UI. 这个模板还有一些额外的选项: @@ -53,8 +53,9 @@ abp new Acme.BookStore * `mongodb`: MongoDB. * `module`: [Module template](Startup-Templates/Module.md). 其他选项: * `--no-ui`: 不包含UI.仅创建服务模块(也称为微服务 - 没有UI). -* `--output-folder` 或者 `-o`: 指定输出文件夹,默认是当前目录. -* `--version` 或者 `-v`: 指定ABP和模板的版本.它可以是 [release tag](https://github.com/abpframework/abp/releases) 或者 [branch name](https://github.com/abpframework/abp/branches). 如果没有指定,则使用最新版本.大多数情况下,您会希望使用最新的版本. +* `--output-folder` 或者 `-o`: 指定输出文件夹,默认是当前目录. +* `--version` 或者 `-v`: 指定ABP和模板的版本.它可以是 [release tag](https://github.com/abpframework/abp/releases) 或者 [branch name](https://github.com/abpframework/abp/branches). 如果没有指定,则使用最新版本.大多数情况下,您会希望使用最新的版本. +* `--template-source`: 指定自定义模板源用于生成项目,可以使用本地源和网络源(例如 `D\localTemplate` 或 `https://.zip`). ### add-package From 47f6b12eea41cc537faef88e0c6b42f78d4839ae Mon Sep 17 00:00:00 2001 From: Yunus Emre Kalkan Date: Mon, 2 Mar 2020 13:35:37 +0300 Subject: [PATCH 37/56] "Cli add-module with source code" should handle test references resolves https://github.com/abpframework/abp/issues/2950 --- .../NugetPackageToLocalReferenceConverter.cs | 73 +++++++++++-------- 1 file changed, 43 insertions(+), 30 deletions(-) diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/NugetPackageToLocalReferenceConverter.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/NugetPackageToLocalReferenceConverter.cs index b1d514eef2..8f566234c2 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/NugetPackageToLocalReferenceConverter.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/NugetPackageToLocalReferenceConverter.cs @@ -15,41 +15,35 @@ namespace Volo.Abp.Cli.ProjectModification public async Task Convert(ModuleWithMastersInfo module, string solutionFile) { var nugetPackageList = GetNugetPackages(module); + var modulesFolder = Path.Combine(Path.GetDirectoryName(solutionFile), "modules"); + var srcFolder = Path.Combine(Path.GetDirectoryName(solutionFile), "src"); + var testFolder = Path.Combine(Path.GetDirectoryName(solutionFile), "test"); - var projectFilesUnderModules = GetProjectFilesUnder(Path.Combine(Path.GetDirectoryName(solutionFile), "modules")); - var projectFilesUnderSrc = GetProjectFilesUnder(Path.Combine(Path.GetDirectoryName(solutionFile), "src")); - var projectFilesUnderTest = GetProjectFilesUnder(Path.Combine(Path.GetDirectoryName(solutionFile), "test")); - - foreach (var projectFile in projectFilesUnderModules) - { - ConvertToLocalReference(projectFile, nugetPackageList, "..\\..\\..\\"); - } - foreach (var projectFile in projectFilesUnderSrc) - { - ConvertToLocalReference(projectFile, nugetPackageList, "..\\..\\modules\\"); - } - foreach (var projectFile in projectFilesUnderTest) - { - ConvertToLocalReference(projectFile, nugetPackageList, "..\\..\\modules\\", "test"); - } + ConvertToLocalReference(modulesFolder, nugetPackageList, "..\\..\\..\\"); + ConvertToLocalReference(srcFolder, nugetPackageList, "..\\..\\modules\\"); + ConvertToLocalReference(testFolder, nugetPackageList, "..\\..\\modules\\", "test"); } - private void ConvertToLocalReference(string projectFile, List nugetPackageList, string localPathPrefix, string sourceFile = "src") + private void ConvertToLocalReference(string folder, List nugetPackageList, string localPathPrefix, string sourceFile = "src") { - var content = File.ReadAllText(projectFile); - var doc = new XmlDocument() { PreserveWhitespace = true }; + var projectFiles = GetProjectFilesUnder(folder); - doc.Load(StreamHelper.GenerateStreamFromString(content)); + foreach (var projectFile in projectFiles) + { + var content = File.ReadAllText(projectFile); + var doc = new XmlDocument() { PreserveWhitespace = true }; - var convertedProject = ProcessReferenceNodes(doc, nugetPackageList, localPathPrefix, sourceFile); + doc.Load(StreamHelper.GenerateStreamFromString(content)); - File.WriteAllText(projectFile, convertedProject); - } + var convertedProject = ProcessReferenceNodes(folder, doc, nugetPackageList, localPathPrefix, sourceFile); + File.WriteAllText(projectFile, convertedProject); + } + } - private string ProcessReferenceNodes(XmlDocument doc, List nugetPackageList, string localPathPrefix, string sourceFile = "src") + private string ProcessReferenceNodes(string folder, XmlDocument doc, List nugetPackageList, string localPathPrefix, string sourceFile = "src") { - var nodes = doc.SelectNodes("/Project/ItemGroup/PackageReference[@Include]"); + var nodes = doc.SelectNodes("/Project/ItemGroup/PackageReference[starts-with(@Include, 'Volo.Abp')]"); if (nodes == null) { @@ -60,17 +54,36 @@ namespace Volo.Abp.Cli.ProjectModification { var oldNodeIncludeValue = oldNode?.Attributes?["Include"]?.Value; - var nugetPackage = nugetPackageList.FirstOrDefault(n => n.NugetPackage.Name == oldNodeIncludeValue); + var moduleName = nugetPackageList.FirstOrDefault(n => n.NugetPackage.Name == oldNodeIncludeValue)?.ModuleName; - if (nugetPackage == null) + if (moduleName == null) { - continue; + var localProject = GetProjectFilesUnder(folder).FirstOrDefault(f=> f.EndsWith($"{oldNodeIncludeValue}.csproj")); + + if (localProject != null) + { + moduleName = Directory.GetParent(Directory.GetParent(Path.GetDirectoryName(localProject)).FullName).Name; + + if (oldNodeIncludeValue.EndsWith(".test", StringComparison.InvariantCultureIgnoreCase) || + oldNodeIncludeValue.EndsWith(".tests", StringComparison.InvariantCultureIgnoreCase)) + { + sourceFile = "test"; + } + else + { + sourceFile = "src"; + } + } + else + { + continue; + } } var referenceProjectPath = - $"{localPathPrefix}{nugetPackage.ModuleName}\\{sourceFile}\\{nugetPackage.NugetPackage.Name}\\{nugetPackage.NugetPackage.Name}.csproj"; + $"{localPathPrefix}{moduleName}\\{sourceFile}\\{oldNodeIncludeValue}\\{oldNodeIncludeValue}.csproj"; - XmlNode newNode = GetNewReferenceNode(doc, referenceProjectPath); + XmlNode newNode = GetNewReferenceNode(doc, referenceProjectPath); oldNode?.ParentNode?.ReplaceChild(newNode, oldNode); } From dc81bb7ca57783a8c2fba577fa63bbfa19cb6ad7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ahmet=20=C3=87otur?= Date: Mon, 2 Mar 2020 15:08:13 +0300 Subject: [PATCH 38/56] boostrap demo components added --- .../AlertsDemo/AlertsDemoViewComponent.cs | 16 ++ .../Shared/Demos/AlertsDemo/Default.cshtml | 70 ++++++ .../BadgesDemo/BadgesDemoViewComponent.cs | 16 ++ .../Shared/Demos/BadgesDemo/Default.cshtml | 49 ++++ .../BordersDemo/BordersDemoViewComponent.cs | 16 ++ .../Shared/Demos/BordersDemo/Default.cshtml | 46 ++++ .../BreadcrumbsDemoViewComponent.cs | 16 ++ .../Demos/BreadcrumbsDemo/Default.cshtml | 18 ++ .../ButtonGroupsDemoViewComponent.cs | 16 ++ .../Demos/ButtonGroupsDemo/Default.cshtml | 68 ++++++ .../Demos/CardsDemo/CardsDemoViewComponent.cs | 16 ++ .../Shared/Demos/CardsDemo/Default.cshtml | 156 ++++++++++++ .../CollapseDemo/CollapseDemoViewComponent.cs | 16 ++ .../Shared/Demos/CollapseDemo/Default.cshtml | 43 ++++ .../Shared/Demos/DropdownsDemo/Default.cshtml | 171 ++++++++++++++ .../DropdownsDemoViewComponent.cs | 16 ++ .../Shared/Demos/GridsDemo/Default.cshtml | 223 ++++++++++++++++++ .../Demos/GridsDemo/GridsDemoViewComponent.cs | 5 + .../Demos/ListGroupsDemo/Default.cshtml | 82 +++++++ .../ListGroupsDemoViewComponent.cs | 16 ++ .../Shared/Demos/ModalsDemo/Default.cshtml | 15 ++ .../ModalsDemo/ModalsDemoViewComponent.cs | 16 ++ .../Shared/Demos/NavsDemo/Default.cshtml | 53 +++++ .../Demos/NavsDemo/NavsDemoViewComponent.cs | 16 ++ .../Shared/Demos/PopoversDemo/Default.cshtml | 16 ++ .../PopoversDemo/PopoversDemoViewComponent.cs | 16 ++ .../Demos/ProgressBarsDemo/Default.cshtml | 17 ++ .../ProgressBarsDemoViewComponent.cs | 16 ++ .../Shared/Demos/TablesDemo/Default.cshtml | 134 +++++++++++ .../TablesDemo/TablesDemoViewComponent.cs | 16 ++ .../Shared/Demos/TabsDemo/Default.cshtml | 63 +++++ .../Demos/TabsDemo/TabsDemoViewComponent.cs | 16 ++ .../Shared/Demos/TooltipsDemo/Default.cshtml | 23 ++ .../TooltipsDemo/TooltipsDemoViewComponent.cs | 16 ++ .../BasicThemeDemoMenuContributor.cs | 59 ++++- .../Pages/Components/Alerts/Index.cshtml | 8 + .../Pages/Components/Alerts/Index.cshtml.cs | 12 + .../Pages/Components/Badges/Index.cshtml | 8 + .../Pages/Components/Badges/Index.cshtml.cs | 12 + .../Pages/Components/Borders/Index.cshtml | 15 ++ .../Pages/Components/Borders/Index.cshtml.cs | 12 + .../Pages/Components/Breadcrumbs/Index.cshtml | 7 + .../Components/Breadcrumbs/Index.cshtml.cs | 12 + .../Components/ButtonGroups/Index.cshtml | 7 + .../Components/ButtonGroups/Index.cshtml.cs | 12 + .../Pages/Components/Cards/Index.cshtml | 7 + .../Pages/Components/Cards/Index.cshtml.cs | 12 + .../Pages/Components/Collapse/Index.cshtml | 7 + .../Pages/Components/Collapse/Index.cshtml.cs | 12 + .../Pages/Components/Dropdowns/Index.cshtml | 7 + .../Components/Dropdowns/Index.cshtml.cs | 12 + .../Pages/Components/Grids/Index.cshtml | 7 + .../Pages/Components/Grids/Index.cshtml.cs | 12 + .../Pages/Components/ListGroups/Index.cshtml | 7 + .../Components/ListGroups/Index.cshtml.cs | 12 + .../Pages/Components/Modals/Index.cshtml | 7 + .../Pages/Components/Modals/Index.cshtml.cs | 12 + .../Pages/Components/Navs/Index.cshtml | 7 + .../Pages/Components/Navs/Index.cshtml.cs | 12 + .../Pages/Components/Popovers/Index.cshtml | 7 + .../Pages/Components/Popovers/Index.cshtml.cs | 12 + .../Components/ProgressBars/Index.cshtml | 7 + .../Components/ProgressBars/Index.cshtml.cs | 12 + .../Pages/Components/Tables/Index.cshtml | 7 + .../Pages/Components/Tables/Index.cshtml.cs | 12 + .../Pages/Components/Tabs/Index.cshtml | 7 + .../Pages/Components/Tabs/Index.cshtml.cs | 12 + .../Pages/Components/Tooltips/Index.cshtml | 7 + .../Pages/Components/Tooltips/Index.cshtml.cs | 12 + 69 files changed, 1895 insertions(+), 5 deletions(-) create mode 100644 framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/Demos/AlertsDemo/AlertsDemoViewComponent.cs create mode 100644 framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/Demos/AlertsDemo/Default.cshtml create mode 100644 framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/Demos/BadgesDemo/BadgesDemoViewComponent.cs create mode 100644 framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/Demos/BadgesDemo/Default.cshtml create mode 100644 framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/Demos/BordersDemo/BordersDemoViewComponent.cs create mode 100644 framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/Demos/BordersDemo/Default.cshtml create mode 100644 framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/Demos/BreadcrumbsDemo/BreadcrumbsDemoViewComponent.cs create mode 100644 framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/Demos/BreadcrumbsDemo/Default.cshtml create mode 100644 framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/Demos/ButtonGroupsDemo/ButtonGroupsDemoViewComponent.cs create mode 100644 framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/Demos/ButtonGroupsDemo/Default.cshtml create mode 100644 framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/Demos/CardsDemo/CardsDemoViewComponent.cs create mode 100644 framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/Demos/CardsDemo/Default.cshtml create mode 100644 framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/Demos/CollapseDemo/CollapseDemoViewComponent.cs create mode 100644 framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/Demos/CollapseDemo/Default.cshtml create mode 100644 framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/Demos/DropdownsDemo/Default.cshtml create mode 100644 framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/Demos/DropdownsDemo/DropdownsDemoViewComponent.cs create mode 100644 framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/Demos/GridsDemo/Default.cshtml create mode 100644 framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/Demos/GridsDemo/GridsDemoViewComponent.cs create mode 100644 framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/Demos/ListGroupsDemo/Default.cshtml create mode 100644 framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/Demos/ListGroupsDemo/ListGroupsDemoViewComponent.cs create mode 100644 framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/Demos/ModalsDemo/Default.cshtml create mode 100644 framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/Demos/ModalsDemo/ModalsDemoViewComponent.cs create mode 100644 framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/Demos/NavsDemo/Default.cshtml create mode 100644 framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/Demos/NavsDemo/NavsDemoViewComponent.cs create mode 100644 framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/Demos/PopoversDemo/Default.cshtml create mode 100644 framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/Demos/PopoversDemo/PopoversDemoViewComponent.cs create mode 100644 framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/Demos/ProgressBarsDemo/Default.cshtml create mode 100644 framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/Demos/ProgressBarsDemo/ProgressBarsDemoViewComponent.cs create mode 100644 framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/Demos/TablesDemo/Default.cshtml create mode 100644 framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/Demos/TablesDemo/TablesDemoViewComponent.cs create mode 100644 framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/Demos/TabsDemo/Default.cshtml create mode 100644 framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/Demos/TabsDemo/TabsDemoViewComponent.cs create mode 100644 framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/Demos/TooltipsDemo/Default.cshtml create mode 100644 framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/Demos/TooltipsDemo/TooltipsDemoViewComponent.cs create mode 100644 framework/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/Pages/Components/Alerts/Index.cshtml create mode 100644 framework/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/Pages/Components/Alerts/Index.cshtml.cs create mode 100644 framework/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/Pages/Components/Badges/Index.cshtml create mode 100644 framework/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/Pages/Components/Badges/Index.cshtml.cs create mode 100644 framework/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/Pages/Components/Borders/Index.cshtml create mode 100644 framework/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/Pages/Components/Borders/Index.cshtml.cs create mode 100644 framework/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/Pages/Components/Breadcrumbs/Index.cshtml create mode 100644 framework/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/Pages/Components/Breadcrumbs/Index.cshtml.cs create mode 100644 framework/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/Pages/Components/ButtonGroups/Index.cshtml create mode 100644 framework/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/Pages/Components/ButtonGroups/Index.cshtml.cs create mode 100644 framework/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/Pages/Components/Cards/Index.cshtml create mode 100644 framework/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/Pages/Components/Cards/Index.cshtml.cs create mode 100644 framework/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/Pages/Components/Collapse/Index.cshtml create mode 100644 framework/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/Pages/Components/Collapse/Index.cshtml.cs create mode 100644 framework/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/Pages/Components/Dropdowns/Index.cshtml create mode 100644 framework/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/Pages/Components/Dropdowns/Index.cshtml.cs create mode 100644 framework/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/Pages/Components/Grids/Index.cshtml create mode 100644 framework/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/Pages/Components/Grids/Index.cshtml.cs create mode 100644 framework/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/Pages/Components/ListGroups/Index.cshtml create mode 100644 framework/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/Pages/Components/ListGroups/Index.cshtml.cs create mode 100644 framework/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/Pages/Components/Modals/Index.cshtml create mode 100644 framework/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/Pages/Components/Modals/Index.cshtml.cs create mode 100644 framework/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/Pages/Components/Navs/Index.cshtml create mode 100644 framework/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/Pages/Components/Navs/Index.cshtml.cs create mode 100644 framework/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/Pages/Components/Popovers/Index.cshtml create mode 100644 framework/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/Pages/Components/Popovers/Index.cshtml.cs create mode 100644 framework/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/Pages/Components/ProgressBars/Index.cshtml create mode 100644 framework/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/Pages/Components/ProgressBars/Index.cshtml.cs create mode 100644 framework/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/Pages/Components/Tables/Index.cshtml create mode 100644 framework/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/Pages/Components/Tables/Index.cshtml.cs create mode 100644 framework/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/Pages/Components/Tabs/Index.cshtml create mode 100644 framework/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/Pages/Components/Tabs/Index.cshtml.cs create mode 100644 framework/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/Pages/Components/Tooltips/Index.cshtml create mode 100644 framework/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/Pages/Components/Tooltips/Index.cshtml.cs diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/Demos/AlertsDemo/AlertsDemoViewComponent.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/Demos/AlertsDemo/AlertsDemoViewComponent.cs new file mode 100644 index 0000000000..2599c317cf --- /dev/null +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/Demos/AlertsDemo/AlertsDemoViewComponent.cs @@ -0,0 +1,16 @@ +using Microsoft.AspNetCore.Mvc; +using Volo.Abp.AspNetCore.Mvc.UI.Widgets; + +namespace Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo.Views.Components.Themes.Shared.Demos.AlertsDemo +{ + [Widget] + public class AlertsDemoViewComponent : AbpViewComponent + { + public const string ViewPath = "/Views/Components/Themes/Shared/Demos/AlertsDemo/Default.cshtml"; + + public IViewComponentResult Invoke() + { + return View(ViewPath); + } + } +} \ No newline at end of file diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/Demos/AlertsDemo/Default.cshtml b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/Demos/AlertsDemo/Default.cshtml new file mode 100644 index 0000000000..8c132b9197 --- /dev/null +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/Demos/AlertsDemo/Default.cshtml @@ -0,0 +1,70 @@ +@using Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo.Views.Components.Themes.Shared.Demos.AlertsDemo + + + + A simple primary alert—check it out! + + + A simple secondary alert—check it out! + + + A simple success alert—check it out! + + + A simple danger alert—check it out! + + + A simple warning alert—check it out! + + + A simple info alert—check it out! + + + A simple light alert—check it out! + + + A simple dark alert—check it out! + + + + + + A simple primary alert with an example link. Give it a click if you like. + + + A simple secondary alert with an example link. Give it a click if you like. + + + A simple success alert with an example link. Give it a click if you like. + + + A simple danger alert with an example link. Give it a click if you like. + + + A simple warning alert with an example link. Give it a click if you like. + + + A simple info alert with an example link. Give it a click if you like. + + + A simple light alert with an example link. Give it a click if you like. + + + A simple dark alert with an example link. Give it a click if you like. + + + + + +

    Well done!

    +

    Aww yeah, you successfully read this important alert message. This example text is going to run a bit longer so that you can see how spacing within an alert works with this kind of content.

    +
    +

    Whenever you need to, be sure to use margin utilities to keep things nice and tidy.

    +
    +
    + + + + Holy guacamole! You should check in on some of those fields below. + + \ No newline at end of file diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/Demos/BadgesDemo/BadgesDemoViewComponent.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/Demos/BadgesDemo/BadgesDemoViewComponent.cs new file mode 100644 index 0000000000..bdc47336cd --- /dev/null +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/Demos/BadgesDemo/BadgesDemoViewComponent.cs @@ -0,0 +1,16 @@ +using Microsoft.AspNetCore.Mvc; +using Volo.Abp.AspNetCore.Mvc.UI.Widgets; + +namespace Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo.Views.Components.Themes.Shared.Demos.BadgesDemo +{ + [Widget] + public class BadgesDemoViewComponent : AbpViewComponent + { + public const string ViewPath = "/Views/Components/Themes/Shared/Demos/BadgesDemo/Default.cshtml"; + + public IViewComponentResult Invoke() + { + return View(ViewPath); + } + } +} \ No newline at end of file diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/Demos/BadgesDemo/Default.cshtml b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/Demos/BadgesDemo/Default.cshtml new file mode 100644 index 0000000000..9ed21ebe3e --- /dev/null +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/Demos/BadgesDemo/Default.cshtml @@ -0,0 +1,49 @@ +@using Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo.Views.Components.Themes.Shared.Demos.BadgesDemo + + +

    Example heading New

    +

    Example heading New

    +

    Example heading New

    +

    Example heading New

    +
    Example heading New
    +
    Example heading New
    +
    + + + + Notifications 4 + + + + + Primary + Secondary + Success + Danger + Warning + Info + Light + Dark + + + + Primary + Secondary + Success + Danger + Warning + Info + Light + Dark + + + + Primary + Secondary + Success + Danger + Warning + Info + Light + Dark + \ No newline at end of file diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/Demos/BordersDemo/BordersDemoViewComponent.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/Demos/BordersDemo/BordersDemoViewComponent.cs new file mode 100644 index 0000000000..2ba33feb54 --- /dev/null +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/Demos/BordersDemo/BordersDemoViewComponent.cs @@ -0,0 +1,16 @@ +using Microsoft.AspNetCore.Mvc; +using Volo.Abp.AspNetCore.Mvc.UI.Widgets; + +namespace Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo.Views.Components.Themes.Shared.Demos.BordersDemo +{ + [Widget] + public class BordersDemoViewComponent : AbpViewComponent + { + public const string ViewPath = "/Views/Components/Themes/Shared/Demos/BordersDemo/Default.cshtml"; + + public IViewComponentResult Invoke() + { + return View(ViewPath); + } + } +} \ No newline at end of file diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/Demos/BordersDemo/Default.cshtml b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/Demos/BordersDemo/Default.cshtml new file mode 100644 index 0000000000..281f6c73ed --- /dev/null +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/Demos/BordersDemo/Default.cshtml @@ -0,0 +1,46 @@ +@using Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo.Views.Components.Themes.Shared.Demos.BordersDemo + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + + + + + +
    + + + + + + + + + diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/Demos/BreadcrumbsDemo/BreadcrumbsDemoViewComponent.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/Demos/BreadcrumbsDemo/BreadcrumbsDemoViewComponent.cs new file mode 100644 index 0000000000..e700acb667 --- /dev/null +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/Demos/BreadcrumbsDemo/BreadcrumbsDemoViewComponent.cs @@ -0,0 +1,16 @@ +using Microsoft.AspNetCore.Mvc; +using Volo.Abp.AspNetCore.Mvc.UI.Widgets; + +namespace Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo.Views.Components.Themes.Shared.Demos.BreadcrumbsDemo +{ + [Widget] + public class BreadcrumbsDemoViewComponent : AbpViewComponent + { + public const string ViewPath = "/Views/Components/Themes/Shared/Demos/BreadcrumbsDemo/Default.cshtml"; + + public IViewComponentResult Invoke() + { + return View(ViewPath); + } + } +} \ No newline at end of file diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/Demos/BreadcrumbsDemo/Default.cshtml b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/Demos/BreadcrumbsDemo/Default.cshtml new file mode 100644 index 0000000000..8338bdfc1f --- /dev/null +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/Demos/BreadcrumbsDemo/Default.cshtml @@ -0,0 +1,18 @@ +@using Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo.Views.Components.Themes.Shared.Demos.BreadcrumbsDemo + + + + + + + + + + + + + + + + + diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/Demos/ButtonGroupsDemo/ButtonGroupsDemoViewComponent.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/Demos/ButtonGroupsDemo/ButtonGroupsDemoViewComponent.cs new file mode 100644 index 0000000000..ff5b917d40 --- /dev/null +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/Demos/ButtonGroupsDemo/ButtonGroupsDemoViewComponent.cs @@ -0,0 +1,16 @@ +using Microsoft.AspNetCore.Mvc; +using Volo.Abp.AspNetCore.Mvc.UI.Widgets; + +namespace Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo.Views.Components.Themes.Shared.Demos.ButtonGroupsDemo +{ + [Widget] + public class ButtonGroupsDemoViewComponent : AbpViewComponent + { + public const string ViewPath = "/Views/Components/Themes/Shared/Demos/ButtonGroupsDemo/Default.cshtml"; + + public IViewComponentResult Invoke() + { + return View(ViewPath); + } + } +} \ No newline at end of file diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/Demos/ButtonGroupsDemo/Default.cshtml b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/Demos/ButtonGroupsDemo/Default.cshtml new file mode 100644 index 0000000000..3039e1b1da --- /dev/null +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/Demos/ButtonGroupsDemo/Default.cshtml @@ -0,0 +1,68 @@ +@using Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo.Views.Components.Themes.Shared.Demos.ButtonGroupsDemo + + + + Left + Middle + Right + + + + + + + 1 + 2 + 3 + 4 + + + 5 + 6 + 7 + + + 8 + + + + + + + Left + Middle + Right + + + Left + Middle + Right + + + Left + Middle + Right + + + + + + 1 + 2 + + + + Dropdown link + Dropdown link + + + + + + + + Left + Middle + Right + + diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/Demos/CardsDemo/CardsDemoViewComponent.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/Demos/CardsDemo/CardsDemoViewComponent.cs new file mode 100644 index 0000000000..f192285f80 --- /dev/null +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/Demos/CardsDemo/CardsDemoViewComponent.cs @@ -0,0 +1,16 @@ +using Microsoft.AspNetCore.Mvc; +using Volo.Abp.AspNetCore.Mvc.UI.Widgets; + +namespace Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo.Views.Components.Themes.Shared.Demos.CardsDemo +{ + [Widget] + public class CardsDemoViewComponent : AbpViewComponent + { + public const string ViewPath = "/Views/Components/Themes/Shared/Demos/CardsDemo/Default.cshtml"; + + public IViewComponentResult Invoke() + { + return View(ViewPath); + } + } +} \ No newline at end of file diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/Demos/CardsDemo/Default.cshtml b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/Demos/CardsDemo/Default.cshtml new file mode 100644 index 0000000000..b37c877f34 --- /dev/null +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/Demos/CardsDemo/Default.cshtml @@ -0,0 +1,156 @@ +@using Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo.Views.Components.Themes.Shared.Demos.CardsDemo + + + + + + Card Title + Some quick example text to build on the card title and make up the bulk of the card's content. + Go somewhere + + + + + + + + Card title + Card subtitle + Some quick example text to build on the card title and make up the bulk of the card's content. + Card link + Another link + + + + + + + + Cras justo odio + Dapibus ac facilisis in + Vestibulum at eros + + + + + + + Featured + + Cras justo odio + Dapibus ac facilisis in + Vestibulum at eros + + + + + + + + + Card TitleSome quick example text to build on the card title and make up the bulk of the card's content. + + + Cras justo odio + Dapibus ac facilisis in + Vestibulum at eros + + + Card link + Another link + + + + + + + Featured + + Special title treatment + With supporting text below as a natural lead-in to additional content. + Go somewhere + + + + + + + Quote + + +

    Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer posuere erat a ante.

    +
    Someone famous in Source Title
    +
    +
    +
    +
    + + + + Featured + + Special title treatment + With supporting text below as a natural lead-in to additional content. + Go somewhere + + 2 days ago + + + + + + Featured + + Special title treatment + With supporting text below as a natural lead-in to additional content. + + + + + Featured + + Special title treatment + With supporting text below as a natural lead-in to additional content. + + + + + Featured + + Special title treatment + With supporting text below as a natural lead-in to additional content. + + + + + Featured + + Special title treatment + With supporting text below as a natural lead-in to additional content. + + + + + Featured + + Special title treatment + With supporting text below as a natural lead-in to additional content. + + + + + Featured + + Special title treatment + With supporting text below as a natural lead-in to additional content. + + + + + Featured + + Special title treatment + With supporting text below as a natural lead-in to additional content. + + + diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/Demos/CollapseDemo/CollapseDemoViewComponent.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/Demos/CollapseDemo/CollapseDemoViewComponent.cs new file mode 100644 index 0000000000..28ccbcb447 --- /dev/null +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/Demos/CollapseDemo/CollapseDemoViewComponent.cs @@ -0,0 +1,16 @@ +using Microsoft.AspNetCore.Mvc; +using Volo.Abp.AspNetCore.Mvc.UI.Widgets; + +namespace Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo.Views.Components.Themes.Shared.Demos.CollapseDemo +{ + [Widget] + public class CollapseDemoViewComponent : AbpViewComponent + { + public const string ViewPath = "/Views/Components/Themes/Shared/Demos/CollapseDemo/Default.cshtml"; + + public IViewComponentResult Invoke() + { + return View(ViewPath); + } + } +} \ No newline at end of file diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/Demos/CollapseDemo/Default.cshtml b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/Demos/CollapseDemo/Default.cshtml new file mode 100644 index 0000000000..6455bef2fc --- /dev/null +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/Demos/CollapseDemo/Default.cshtml @@ -0,0 +1,43 @@ +@using Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo.Views.Components.Themes.Shared.Demos.CollapseDemo + + + + Link with href + + + Anim pariatur wolf moon tempor,,, sunt aliqua put a bird on it squid single-origin coffee nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident. Ad vegan excepteur butcher vice lomo. Leggings occaecat craft beer farm-to-table, raw denim aesthetic synth nesciunt you probably haven't heard of them accusamus labore sustainable VHS. + + + + + Toggle first element + + + + + + + Curabitur porta porttitor libero eu luctus. Praesent ultrices mattis commodo. Integer sodales massa risus, in molestie enim sagittis blandit + + + + + Anim pariatur wolf moon tempor,,, sunt aliqua put a bird on it squid single-origin coffee nulla assumenda shoreditch et. + + + + + + + + + Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry rtat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor, sunt aliqua put a bird on it squid single-origin coffee nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident. Ad vegan excepteur butcher vice lomo. Leggings occaecat craft beer farm-to-table, raw denim aesthetic synth nesciunt you probably haven't heard of them accusamus labore sustainable VHS. + + + Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor, sunt aliqua put a bird on it squid single-origin coffee nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident. Ad vegan excepteur butcher vice lomo. Leggings occaecat craft beer farm-to-table, raw denim aesthetic synth nesciunt you probably haven't heard of them accusamus labore sustainable VHS. + + + Anim pariatur wolf moon tempor, sunt aliqua put a bird on it squid single-origin coffee nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident. Ad vegan excepteur butcher vice lomo. Leggings occaecat craft beer farm-to-table, raw denim aesthetic synth nesciunt you probably haven't heard of them accusamus labore sustainable VHS. + + + diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/Demos/DropdownsDemo/Default.cshtml b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/Demos/DropdownsDemo/Default.cshtml new file mode 100644 index 0000000000..26a0c63e3c --- /dev/null +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/Demos/DropdownsDemo/Default.cshtml @@ -0,0 +1,171 @@ +@using Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo.Views.Components.Themes.Shared.Demos.DropdownsDemo + + + + + + Action + Another action + Something else here + + + + + + + + + Action + Another action + Something else here + + + + + + + + + Action + Another action + Something else here + + Separated link + + + + + + + + + Action + Another action + Something else here + + Separated link + + + + + + + + + Action + Another action + Something else here + + Separated link + + + + + Action + Another action + Something else here + + Separated link + + + + + Action + Another action + Something else here + + Separated link + + + + + Action + Another action + Something else here + + Separated link + + + + + + + + + Action + Another action + Something else here + + + + + Action + Another action + Something else here + + + + + Action + Another action + Something else here + + + + + + + + + Dropdown Header + Action + Active action + Disabled action + + Dropdown Item Text + Something else here + + + + + + + + + Action + Active action + Disabled action + + + + + + + + +

    + Some example text that's free-flowing within the dropdown menu. +

    +

    + And this is more example text. +

    +
    +
    +
    + + + + + +
    + + + + + + + New around here? Sign up + Forgot password? +
    +
    +
    diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/Demos/DropdownsDemo/DropdownsDemoViewComponent.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/Demos/DropdownsDemo/DropdownsDemoViewComponent.cs new file mode 100644 index 0000000000..2aa67f8616 --- /dev/null +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/Demos/DropdownsDemo/DropdownsDemoViewComponent.cs @@ -0,0 +1,16 @@ +using Microsoft.AspNetCore.Mvc; +using Volo.Abp.AspNetCore.Mvc.UI.Widgets; + +namespace Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo.Views.Components.Themes.Shared.Demos.DropdownsDemo +{ + [Widget] + public class DropdownsDemoViewComponent : AbpViewComponent + { + public const string ViewPath = "/Views/Components/Themes/Shared/Demos/DropdownsDemo/Default.cshtml"; + + public IViewComponentResult Invoke() + { + return View(ViewPath); + } + } +} \ No newline at end of file diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/Demos/GridsDemo/Default.cshtml b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/Demos/GridsDemo/Default.cshtml new file mode 100644 index 0000000000..ee043b71e1 --- /dev/null +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/Demos/GridsDemo/Default.cshtml @@ -0,0 +1,223 @@ +@using Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo.Views.Components.Themes.Shared.Demos.GridsDemo + + + + + 1 of 2 + 2 of 2 + + + 1 of 3 + 2 of 3 + 3 of 3 + + + + + + + + column + column + + column + column + + + + + + + + 1 of 3 + 2 of 3 (wider) + 3 of 3 + + + 1 of 3 + 2 of 3 (wider) + 3 of 3 + + + + + + + + 1 of 3 + Variable width content + 3 of 3 + + + 1 of 3 + Variable width content + 3 of 3 + + + + + + + col + col + col + col + + + col-8 + col-4 + + + + + + col-sm-8 + col-sm-4 + + + col-sm + col-sm + col-sm + col-sm + + + + + + + .col-12 .col-md-8 + .col-6 .col-md-4 + + + + + .col-6 .col-md-4 + .col-6 .col-md-4 + .col-6 .col-md-4 + + + + + .col-6 + .col-6 + + + + + + + column + column + column + + + column + column + column + + + column + column + column + + + + + + + + column + column + column + + + + + + + + One of two columns + One of two columns + + + One of two columns + One of two columns + + + One of two columns + One of two columns + + + One of two columns + One of two columns + + + One of two columns + One of two columns + + + + + + + One of two columns + One of two columns + + + + + + .col-9 + .col-4
    Since 9 + 4 = 13 > 12, this 4-column-wide div gets wrapped onto a new line as one contiguous unit.
    + .col-6
    Subsequent columns continue along the new line.s
    +
    +
    + + + + + First, but Last + Second, but unordered + Third, but Second + + + + + + + + First, but Last + Second, but unordered + Third, but First + + + + + + + + .col-md-4 + .col-md-4 .offset-md-4 + + + .col-md-3 .offset-md-3 + .col-md-3 .offset-md-3 + + + .col-md-6 .offset-md-3 + + + + + + + + .col-sm-5 .col-md-6 + .col-sm-5 .offset-sm-2 .col-md-6 .offset-md-0 + + + col-sm-6 .col-md-5 .col-lg-6 + .col-sm-6 .col-md-5 .offset-md-2 .col-lg-6 .offset-lg-0 + + + diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/Demos/GridsDemo/GridsDemoViewComponent.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/Demos/GridsDemo/GridsDemoViewComponent.cs new file mode 100644 index 0000000000..8a7f82b081 --- /dev/null +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/Demos/GridsDemo/GridsDemoViewComponent.cs @@ -0,0 +1,5 @@ +using Microsoft.AspNetCore.Mvc; +using Volo.Abp.AspNetCore.Mvc.UI.Widgets; + +namespace Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo.Views.Components.Themes.Shared.Demos.GridsDemo +{ diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/Demos/ListGroupsDemo/Default.cshtml b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/Demos/ListGroupsDemo/Default.cshtml new file mode 100644 index 0000000000..ff11769976 --- /dev/null +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/Demos/ListGroupsDemo/Default.cshtml @@ -0,0 +1,82 @@ +@using Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo.Views.Components.Themes.Shared.Demos.ListGroupsDemo + + + + Cras justo odio + Dapibus ac facilisis in + Morbi leo risus + Vestibulum at eros + + + + + + Cras justo odio + Dapibus ac facilisis in + Morbi leo risus + Vestibulum at eros + + + + + + Cras justo odio + Dapibus ac facilisis in + Morbi leo risus + Vestibulum at eros + + + + + + Cras justo odio + Dapibus ac facilisis in + Morbi leo risus + Vestibulum at eros + + + + + + Cras justo odio + Dapibus ac facilisis in + Morbi leo risus + Vestibulum at eros + + + + + + Cras justo odio + A simple Primary list group item + A simple Secondary list group item + A simple Success list group item + A simple Danger list group item + A simple Warning list group item + A simple Info list group item + A simple Light list group item + A simple Dark list group item + + + + + + Cras justo odio + A simple Primary list group item + A simple Secondary list group item + A simple Success list group item + A simple Danger list group item + A simple Warning list group item + A simple Info list group item + A simple Light list group item + A simple Dark list group item + + + + + + Cras justo odio 14 + Dapibus ac facilisis in 2 + Morbi leo risus 1 + + diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/Demos/ListGroupsDemo/ListGroupsDemoViewComponent.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/Demos/ListGroupsDemo/ListGroupsDemoViewComponent.cs new file mode 100644 index 0000000000..9e0f89e325 --- /dev/null +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/Demos/ListGroupsDemo/ListGroupsDemoViewComponent.cs @@ -0,0 +1,16 @@ +using Microsoft.AspNetCore.Mvc; +using Volo.Abp.AspNetCore.Mvc.UI.Widgets; + +namespace Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo.Views.Components.Themes.Shared.Demos.ListGroupsDemo +{ + [Widget] + public class ListGroupsDemoViewComponent : AbpViewComponent + { + public const string ViewPath = "/Views/Components/Themes/Shared/Demos/ListGroupsDemo/Default.cshtml"; + + public IViewComponentResult Invoke() + { + return View(ViewPath); + } + } +} \ No newline at end of file diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/Demos/ModalsDemo/Default.cshtml b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/Demos/ModalsDemo/Default.cshtml new file mode 100644 index 0000000000..91ed5b8bff --- /dev/null +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/Demos/ModalsDemo/Default.cshtml @@ -0,0 +1,15 @@ +@using Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo.Views.Components.Themes.Shared.Demos.ModalsDemo +@using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Modal + + + + Launch modal + + + + + Woohoo, you're reading this text in a modal! + + + + diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/Demos/ModalsDemo/ModalsDemoViewComponent.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/Demos/ModalsDemo/ModalsDemoViewComponent.cs new file mode 100644 index 0000000000..272ea4a480 --- /dev/null +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/Demos/ModalsDemo/ModalsDemoViewComponent.cs @@ -0,0 +1,16 @@ +using Microsoft.AspNetCore.Mvc; +using Volo.Abp.AspNetCore.Mvc.UI.Widgets; + +namespace Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo.Views.Components.Themes.Shared.Demos.ModalsDemo +{ + [Widget] + public class ModalsDemoViewComponent : AbpViewComponent + { + public const string ViewPath = "/Views/Components/Themes/Shared/Demos/ModalsDemo/Default.cshtml"; + + public IViewComponentResult Invoke() + { + return View(ViewPath); + } + } +} \ No newline at end of file diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/Demos/NavsDemo/Default.cshtml b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/Demos/NavsDemo/Default.cshtml new file mode 100644 index 0000000000..033fefa45b --- /dev/null +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/Demos/NavsDemo/Default.cshtml @@ -0,0 +1,53 @@ +@using Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo.Views.Components.Themes.Shared.Demos.NavsDemo + + + + + Active + + + Longer nav link + + + link + + + disabled + + + + + + + Navbar + + + + Home (current) + + + Link + + + + + + Dropdown header + Action + Another disabled action + Something else here + + Separated link + + + + + Disabled + + + + Sample Text + + + + diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/Demos/NavsDemo/NavsDemoViewComponent.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/Demos/NavsDemo/NavsDemoViewComponent.cs new file mode 100644 index 0000000000..5bc0363193 --- /dev/null +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/Demos/NavsDemo/NavsDemoViewComponent.cs @@ -0,0 +1,16 @@ +using Microsoft.AspNetCore.Mvc; +using Volo.Abp.AspNetCore.Mvc.UI.Widgets; + +namespace Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo.Views.Components.Themes.Shared.Demos.NavsDemo +{ + [Widget] + public class NavsDemoViewComponent : AbpViewComponent + { + public const string ViewPath = "/Views/Components/Themes/Shared/Demos/NavsDemo/Default.cshtml"; + + public IViewComponentResult Invoke() + { + return View(ViewPath); + } + } +} \ No newline at end of file diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/Demos/PopoversDemo/Default.cshtml b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/Demos/PopoversDemo/Default.cshtml new file mode 100644 index 0000000000..8e171cb640 --- /dev/null +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/Demos/PopoversDemo/Default.cshtml @@ -0,0 +1,16 @@ +@using Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo.Views.Components.Themes.Shared.Demos.PopoversDemo + + + + Popover Default + + + Popover With Title + + + Dismissible Popover + + + Disabled Popover + + diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/Demos/PopoversDemo/PopoversDemoViewComponent.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/Demos/PopoversDemo/PopoversDemoViewComponent.cs new file mode 100644 index 0000000000..6114918165 --- /dev/null +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/Demos/PopoversDemo/PopoversDemoViewComponent.cs @@ -0,0 +1,16 @@ +using Microsoft.AspNetCore.Mvc; +using Volo.Abp.AspNetCore.Mvc.UI.Widgets; + +namespace Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo.Views.Components.Themes.Shared.Demos.PopoversDemo +{ + [Widget] + public class PopoversDemoViewComponent : AbpViewComponent + { + public const string ViewPath = "/Views/Components/Themes/Shared/Demos/PopoversDemo/Default.cshtml"; + + public IViewComponentResult Invoke() + { + return View(ViewPath); + } + } +} \ No newline at end of file diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/Demos/ProgressBarsDemo/Default.cshtml b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/Demos/ProgressBarsDemo/Default.cshtml new file mode 100644 index 0000000000..00f917b28a --- /dev/null +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/Demos/ProgressBarsDemo/Default.cshtml @@ -0,0 +1,17 @@ +@using Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo.Views.Components.Themes.Shared.Demos.ProgressBarsDemo + + + + + %25 + + + + %50 + + + + %10 + + + diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/Demos/ProgressBarsDemo/ProgressBarsDemoViewComponent.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/Demos/ProgressBarsDemo/ProgressBarsDemoViewComponent.cs new file mode 100644 index 0000000000..acaf9b4135 --- /dev/null +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/Demos/ProgressBarsDemo/ProgressBarsDemoViewComponent.cs @@ -0,0 +1,16 @@ +using Microsoft.AspNetCore.Mvc; +using Volo.Abp.AspNetCore.Mvc.UI.Widgets; + +namespace Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo.Views.Components.Themes.Shared.Demos.ProgressBarsDemo +{ + [Widget] + public class ProgressBarsDemoViewComponent : AbpViewComponent + { + public const string ViewPath = "/Views/Components/Themes/Shared/Demos/ProgressBarsDemo/Default.cshtml"; + + public IViewComponentResult Invoke() + { + return View(ViewPath); + } + } +} \ No newline at end of file diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/Demos/TablesDemo/Default.cshtml b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/Demos/TablesDemo/Default.cshtml new file mode 100644 index 0000000000..d1ddbf16df --- /dev/null +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/Demos/TablesDemo/Default.cshtml @@ -0,0 +1,134 @@ +@using Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo.Views.Components.Themes.Shared.Demos.TablesDemo + + + + + + # + First + Last + Handle + + + + + 1 + Mark + Otto + mdo + + + 2 + Jacob + Thornton + fat + + + 3 + Larry + the Bird + twitter + + + + + + + + + + # + First + Last + Handle + + + + + 1 + Mark + Otto + mdo + + + 2 + Jacob + Thornton + fat + + + 3 + Larry + the Bird + twitter + + + + + + + + List of users + + + # + First + Last + Handle + + + + + 1 + Mark + Otto + mdo + + + 2 + Jacob + Thornton + fat + + + 3 + Larry + the Bird + twitter + + + + + + + + + + # + First + Last + Handle + + + + + 1 + Mark + Otto + mdo + + + 2 + Jacob + Thornton + fat + + + 3 + Larry + the Bird + twitter + + + + diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/Demos/TablesDemo/TablesDemoViewComponent.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/Demos/TablesDemo/TablesDemoViewComponent.cs new file mode 100644 index 0000000000..e40ecae321 --- /dev/null +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/Demos/TablesDemo/TablesDemoViewComponent.cs @@ -0,0 +1,16 @@ +using Microsoft.AspNetCore.Mvc; +using Volo.Abp.AspNetCore.Mvc.UI.Widgets; + +namespace Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo.Views.Components.Themes.Shared.Demos.TablesDemo +{ + [Widget] + public class TablesDemoViewComponent : AbpViewComponent + { + public const string ViewPath = "/Views/Components/Themes/Shared/Demos/TablesDemo/Default.cshtml"; + + public IViewComponentResult Invoke() + { + return View(ViewPath); + } + } +} \ No newline at end of file diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/Demos/TabsDemo/Default.cshtml b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/Demos/TabsDemo/Default.cshtml new file mode 100644 index 0000000000..e91c67d02c --- /dev/null +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/Demos/TabsDemo/Default.cshtml @@ -0,0 +1,63 @@ +@using Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo.Views.Components.Themes.Shared.Demos.TabsDemo + + + + + Content_Home + + + + Content_Profile + + + + Content_1_Content + + + Content_2_Content + + + + + + + + + Content_Home + + + Content_Profile + + + Content_Contact + + + + + + + + Content_Home + + + Content_Profile + + + Content_Contact + + + + + + + + Content_Home + + + Content_Profile + + + Content_Contact + + + diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/Demos/TabsDemo/TabsDemoViewComponent.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/Demos/TabsDemo/TabsDemoViewComponent.cs new file mode 100644 index 0000000000..00f3b5c2c4 --- /dev/null +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/Demos/TabsDemo/TabsDemoViewComponent.cs @@ -0,0 +1,16 @@ +using Microsoft.AspNetCore.Mvc; +using Volo.Abp.AspNetCore.Mvc.UI.Widgets; + +namespace Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo.Views.Components.Themes.Shared.Demos.TabsDemo +{ + [Widget] + public class TabsDemoViewComponent : AbpViewComponent + { + public const string ViewPath = "/Views/Components/Themes/Shared/Demos/TabsDemo/Default.cshtml"; + + public IViewComponentResult Invoke() + { + return View(ViewPath); + } + } +} \ No newline at end of file diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/Demos/TooltipsDemo/Default.cshtml b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/Demos/TooltipsDemo/Default.cshtml new file mode 100644 index 0000000000..b611237b29 --- /dev/null +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/Demos/TooltipsDemo/Default.cshtml @@ -0,0 +1,23 @@ +@using Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo.Views.Components.Themes.Shared.Demos.TooltipsDemo + + + + Tooltip Default + + + + Tooltip on top + + + + Tooltip on right + + + + Tooltip on bottom + + + + Disabled button Tooltip + + diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/Demos/TooltipsDemo/TooltipsDemoViewComponent.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/Demos/TooltipsDemo/TooltipsDemoViewComponent.cs new file mode 100644 index 0000000000..a23fede627 --- /dev/null +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/Demos/TooltipsDemo/TooltipsDemoViewComponent.cs @@ -0,0 +1,16 @@ +using Microsoft.AspNetCore.Mvc; +using Volo.Abp.AspNetCore.Mvc.UI.Widgets; + +namespace Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo.Views.Components.Themes.Shared.Demos.TooltipsDemo +{ + [Widget] + public class TooltipsDemoViewComponent : AbpViewComponent + { + public const string ViewPath = "/Views/Components/Themes/Shared/Demos/TooltipsDemo/Default.cshtml"; + + public IViewComponentResult Invoke() + { + return View(ViewPath); + } + } +} \ No newline at end of file diff --git a/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/BasicThemeDemoMenuContributor.cs b/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/BasicThemeDemoMenuContributor.cs index 46d0467392..4cc57344e9 100644 --- a/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/BasicThemeDemoMenuContributor.cs +++ b/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/BasicThemeDemoMenuContributor.cs @@ -17,12 +17,61 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo private void AddMainMenuItems(MenuConfigurationContext context) { - context.Menu.AddItem( - new ApplicationMenuItem("BasicThemeDemo.Components", "Components") - .AddItem( - new ApplicationMenuItem("BasicThemeDemo.Components.Buttons", "Buttons", url: "/Components/Buttons") - ) + var menuItem = new ApplicationMenuItem("BasicThemeDemo.Components", "Components"); + menuItem.AddItem( + new ApplicationMenuItem("BasicThemeDemo.Components.Alerts", "Alerts", url: "/Components/Alerts") ); + menuItem.AddItem( + new ApplicationMenuItem("BasicThemeDemo.Components.Badges", "Badges", url: "/Components/Badges") + ); + menuItem.AddItem( + new ApplicationMenuItem("BasicThemeDemo.Components.Borders", "Borders", url: "/Components/Borders") + ); + menuItem.AddItem( + new ApplicationMenuItem("BasicThemeDemo.Components.Breadcrumbs", "Breadcrumbs", url: "/Components/Breadcrumbs") + ); + menuItem.AddItem( + new ApplicationMenuItem("BasicThemeDemo.Components.Buttons", "Buttons", url: "/Components/Buttons") + ); + menuItem.AddItem( + new ApplicationMenuItem("BasicThemeDemo.Components.Cards", "Cards", url: "/Components/Cards") + ); + menuItem.AddItem( + new ApplicationMenuItem("BasicThemeDemo.Components.Collapse", "Collapse", url: "/Components/Collapse") + ); + //menuItem.AddItem( + // new ApplicationMenuItem("BasicThemeDemo.Components.Dropdowns", "Dropdowns", url: "/Components/Dropdowns") + //); + menuItem.AddItem( + new ApplicationMenuItem("BasicThemeDemo.Components.Grids", "Grids", url: "/Components/Grids") + ); + menuItem.AddItem( + new ApplicationMenuItem("BasicThemeDemo.Components.ListGroups", "List Groups", url: "/Components/ListGroups") + ); + menuItem.AddItem( + new ApplicationMenuItem("BasicThemeDemo.Components.Modals", "Modals", url: "/Components/Modals") + ); + menuItem.AddItem( + new ApplicationMenuItem("BasicThemeDemo.Components.Navs", "Navs", url: "/Components/Navs") + ); + menuItem.AddItem( + new ApplicationMenuItem("BasicThemeDemo.Components.Popovers", "Popovers", url: "/Components/Popovers") + ); + menuItem.AddItem( + new ApplicationMenuItem("BasicThemeDemo.Components.ProgressBars", "Progress Bars", url: "/Components/ProgressBars") + ); + menuItem.AddItem( + new ApplicationMenuItem("BasicThemeDemo.Components.Tables", "Tables", url: "/Components/Tables") + ); + menuItem.AddItem( + new ApplicationMenuItem("BasicThemeDemo.Components.Tabs", "Tabs", url: "/Components/Tabs") + ); + menuItem.AddItem( + new ApplicationMenuItem("BasicThemeDemo.Components.Tooltips", "Tooltips", url: "/Components/Tooltips") + ); + + + context.Menu.AddItem(menuItem); } } } diff --git a/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/Pages/Components/Alerts/Index.cshtml b/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/Pages/Components/Alerts/Index.cshtml new file mode 100644 index 0000000000..d02be8912e --- /dev/null +++ b/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/Pages/Components/Alerts/Index.cshtml @@ -0,0 +1,8 @@ +@page +@using Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo.Views.Components.Themes.Shared.Demos.AlertsDemo +@model Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo.Pages.Components.Alerts.IndexModel + +

    Alerts

    +

    Based on Bootstrap Alert.

    + +@await Component.InvokeAsync(typeof(AlertsDemoViewComponent)) \ No newline at end of file diff --git a/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/Pages/Components/Alerts/Index.cshtml.cs b/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/Pages/Components/Alerts/Index.cshtml.cs new file mode 100644 index 0000000000..1187dc021a --- /dev/null +++ b/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/Pages/Components/Alerts/Index.cshtml.cs @@ -0,0 +1,12 @@ +using Microsoft.AspNetCore.Mvc.RazorPages; + +namespace Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo.Pages.Components.Alerts +{ + public class IndexModel : PageModel + { + public void OnGet() + { + + } + } +} \ No newline at end of file diff --git a/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/Pages/Components/Badges/Index.cshtml b/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/Pages/Components/Badges/Index.cshtml new file mode 100644 index 0000000000..21e8be5bcf --- /dev/null +++ b/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/Pages/Components/Badges/Index.cshtml @@ -0,0 +1,8 @@ +@page +@using Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo.Views.Components.Themes.Shared.Demos.BadgesDemo +@model Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo.Pages.Components.Badges.IndexModel + +

    Badges

    +

    Based on Bootstrap Badge.

    + +@await Component.InvokeAsync(typeof(BadgesDemoViewComponent)) \ No newline at end of file diff --git a/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/Pages/Components/Badges/Index.cshtml.cs b/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/Pages/Components/Badges/Index.cshtml.cs new file mode 100644 index 0000000000..75067fcc35 --- /dev/null +++ b/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/Pages/Components/Badges/Index.cshtml.cs @@ -0,0 +1,12 @@ +using Microsoft.AspNetCore.Mvc.RazorPages; + +namespace Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo.Pages.Components.Badges +{ + public class IndexModel : PageModel + { + public void OnGet() + { + + } + } +} \ No newline at end of file diff --git a/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/Pages/Components/Borders/Index.cshtml b/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/Pages/Components/Borders/Index.cshtml new file mode 100644 index 0000000000..ce4d20f635 --- /dev/null +++ b/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/Pages/Components/Borders/Index.cshtml @@ -0,0 +1,15 @@ +@page +@using Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo.Views.Components.Themes.Shared.Demos.BordersDemo +@model Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo.Pages.Components.Borders.IndexModel +

    Borders

    +

    Based on Bootstrap Border.

    + +@await Component.InvokeAsync(typeof(BordersDemoViewComponent)) \ No newline at end of file diff --git a/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/Pages/Components/Borders/Index.cshtml.cs b/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/Pages/Components/Borders/Index.cshtml.cs new file mode 100644 index 0000000000..65ec1dc8dd --- /dev/null +++ b/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/Pages/Components/Borders/Index.cshtml.cs @@ -0,0 +1,12 @@ +using Microsoft.AspNetCore.Mvc.RazorPages; + +namespace Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo.Pages.Components.Borders +{ + public class IndexModel : PageModel + { + public void OnGet() + { + + } + } +} \ No newline at end of file diff --git a/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/Pages/Components/Breadcrumbs/Index.cshtml b/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/Pages/Components/Breadcrumbs/Index.cshtml new file mode 100644 index 0000000000..380c3b1e66 --- /dev/null +++ b/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/Pages/Components/Breadcrumbs/Index.cshtml @@ -0,0 +1,7 @@ +@page +@using Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo.Views.Components.Themes.Shared.Demos.BreadcrumbsDemo +@model Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo.Pages.Components.Breadcrumbs.IndexModel +

    Breadcrumbs

    +

    Based on Bootstrap Breadcrumb.

    + +@await Component.InvokeAsync(typeof(BreadcrumbsDemoViewComponent)) \ No newline at end of file diff --git a/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/Pages/Components/Breadcrumbs/Index.cshtml.cs b/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/Pages/Components/Breadcrumbs/Index.cshtml.cs new file mode 100644 index 0000000000..e4f35e84a6 --- /dev/null +++ b/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/Pages/Components/Breadcrumbs/Index.cshtml.cs @@ -0,0 +1,12 @@ +using Microsoft.AspNetCore.Mvc.RazorPages; + +namespace Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo.Pages.Components.Breadcrumbs +{ + public class IndexModel : PageModel + { + public void OnGet() + { + + } + } +} \ No newline at end of file diff --git a/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/Pages/Components/ButtonGroups/Index.cshtml b/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/Pages/Components/ButtonGroups/Index.cshtml new file mode 100644 index 0000000000..d9f803a1bd --- /dev/null +++ b/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/Pages/Components/ButtonGroups/Index.cshtml @@ -0,0 +1,7 @@ +@page +@using Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo.Views.Components.Themes.Shared.Demos.ButtonGroupsDemo +@model Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo.Pages.Components.ButtonGroups.IndexModel +

    Button Groups

    +

    Based on Bootstrap Button group.

    + +@await Component.InvokeAsync(typeof(ButtonGroupsDemoViewComponent)) \ No newline at end of file diff --git a/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/Pages/Components/ButtonGroups/Index.cshtml.cs b/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/Pages/Components/ButtonGroups/Index.cshtml.cs new file mode 100644 index 0000000000..fcc91c386b --- /dev/null +++ b/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/Pages/Components/ButtonGroups/Index.cshtml.cs @@ -0,0 +1,12 @@ +using Microsoft.AspNetCore.Mvc.RazorPages; + +namespace Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo.Pages.Components.ButtonGroups +{ + public class IndexModel : PageModel + { + public void OnGet() + { + + } + } +} \ No newline at end of file diff --git a/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/Pages/Components/Cards/Index.cshtml b/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/Pages/Components/Cards/Index.cshtml new file mode 100644 index 0000000000..d0a2be5f44 --- /dev/null +++ b/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/Pages/Components/Cards/Index.cshtml @@ -0,0 +1,7 @@ +@page +@using Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo.Views.Components.Themes.Shared.Demos.CardsDemo +@model Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo.Pages.Components.Cards.IndexModel +

    Cards

    +

    Based on Bootstrap card.

    + +@await Component.InvokeAsync(typeof(CardsDemoViewComponent)) \ No newline at end of file diff --git a/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/Pages/Components/Cards/Index.cshtml.cs b/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/Pages/Components/Cards/Index.cshtml.cs new file mode 100644 index 0000000000..94761d1828 --- /dev/null +++ b/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/Pages/Components/Cards/Index.cshtml.cs @@ -0,0 +1,12 @@ +using Microsoft.AspNetCore.Mvc.RazorPages; + +namespace Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo.Pages.Components.Cards +{ + public class IndexModel : PageModel + { + public void OnGet() + { + + } + } +} \ No newline at end of file diff --git a/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/Pages/Components/Collapse/Index.cshtml b/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/Pages/Components/Collapse/Index.cshtml new file mode 100644 index 0000000000..5dde43970d --- /dev/null +++ b/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/Pages/Components/Collapse/Index.cshtml @@ -0,0 +1,7 @@ +@page +@using Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo.Views.Components.Themes.Shared.Demos.CollapseDemo +@model Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo.Pages.Components.Collapse.IndexModel +

    Collapse

    +

    Based on Bootstrap Collapse.

    + +@await Component.InvokeAsync(typeof(CollapseDemoViewComponent)) \ No newline at end of file diff --git a/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/Pages/Components/Collapse/Index.cshtml.cs b/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/Pages/Components/Collapse/Index.cshtml.cs new file mode 100644 index 0000000000..afaaf65d10 --- /dev/null +++ b/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/Pages/Components/Collapse/Index.cshtml.cs @@ -0,0 +1,12 @@ +using Microsoft.AspNetCore.Mvc.RazorPages; + +namespace Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo.Pages.Components.Collapse +{ + public class IndexModel : PageModel + { + public void OnGet() + { + + } + } +} \ No newline at end of file diff --git a/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/Pages/Components/Dropdowns/Index.cshtml b/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/Pages/Components/Dropdowns/Index.cshtml new file mode 100644 index 0000000000..2aa853bac9 --- /dev/null +++ b/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/Pages/Components/Dropdowns/Index.cshtml @@ -0,0 +1,7 @@ +@page +@using Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo.Views.Components.Themes.Shared.Demos.DropdownsDemo +@model Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo.Pages.Components.Dropdowns.IndexModel +

    Cards

    +

    Based on Bootstrap button.

    + +@await Component.InvokeAsync(typeof(DropdownsDemoViewComponent)) \ No newline at end of file diff --git a/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/Pages/Components/Dropdowns/Index.cshtml.cs b/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/Pages/Components/Dropdowns/Index.cshtml.cs new file mode 100644 index 0000000000..6d27a631d4 --- /dev/null +++ b/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/Pages/Components/Dropdowns/Index.cshtml.cs @@ -0,0 +1,12 @@ +using Microsoft.AspNetCore.Mvc.RazorPages; + +namespace Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo.Pages.Components.Dropdowns +{ + public class IndexModel : PageModel + { + public void OnGet() + { + + } + } +} \ No newline at end of file diff --git a/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/Pages/Components/Grids/Index.cshtml b/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/Pages/Components/Grids/Index.cshtml new file mode 100644 index 0000000000..de80040d47 --- /dev/null +++ b/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/Pages/Components/Grids/Index.cshtml @@ -0,0 +1,7 @@ +@page +@using Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo.Views.Components.Themes.Shared.Demos.GridsDemo +@model Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo.Pages.Components.Grids.IndexModel +

    Grids

    +

    Based on Bootstrap grid.

    + +@await Component.InvokeAsync(typeof(GridsDemoViewComponent)) \ No newline at end of file diff --git a/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/Pages/Components/Grids/Index.cshtml.cs b/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/Pages/Components/Grids/Index.cshtml.cs new file mode 100644 index 0000000000..e8d829cf52 --- /dev/null +++ b/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/Pages/Components/Grids/Index.cshtml.cs @@ -0,0 +1,12 @@ +using Microsoft.AspNetCore.Mvc.RazorPages; + +namespace Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo.Pages.Components.Grids +{ + public class IndexModel : PageModel + { + public void OnGet() + { + + } + } +} \ No newline at end of file diff --git a/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/Pages/Components/ListGroups/Index.cshtml b/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/Pages/Components/ListGroups/Index.cshtml new file mode 100644 index 0000000000..64eadfa161 --- /dev/null +++ b/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/Pages/Components/ListGroups/Index.cshtml @@ -0,0 +1,7 @@ +@page +@using Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo.Views.Components.Themes.Shared.Demos.ListGroupsDemo +@model Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo.Pages.Components.ListGroups.IndexModel +

    List Groups

    +

    Based on Bootstrap List Group.

    + +@await Component.InvokeAsync(typeof(ListGroupsDemoViewComponent)) \ No newline at end of file diff --git a/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/Pages/Components/ListGroups/Index.cshtml.cs b/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/Pages/Components/ListGroups/Index.cshtml.cs new file mode 100644 index 0000000000..9f324dcbb0 --- /dev/null +++ b/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/Pages/Components/ListGroups/Index.cshtml.cs @@ -0,0 +1,12 @@ +using Microsoft.AspNetCore.Mvc.RazorPages; + +namespace Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo.Pages.Components.ListGroups +{ + public class IndexModel : PageModel + { + public void OnGet() + { + + } + } +} \ No newline at end of file diff --git a/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/Pages/Components/Modals/Index.cshtml b/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/Pages/Components/Modals/Index.cshtml new file mode 100644 index 0000000000..cec4610e76 --- /dev/null +++ b/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/Pages/Components/Modals/Index.cshtml @@ -0,0 +1,7 @@ +@page +@using Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo.Views.Components.Themes.Shared.Demos.ModalsDemo +@model Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo.Pages.Components.Modals.IndexModel +

    Modals

    +

    Based on Bootstrap Modal.

    + +@await Component.InvokeAsync(typeof(ModalsDemoViewComponent)) \ No newline at end of file diff --git a/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/Pages/Components/Modals/Index.cshtml.cs b/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/Pages/Components/Modals/Index.cshtml.cs new file mode 100644 index 0000000000..35749b0832 --- /dev/null +++ b/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/Pages/Components/Modals/Index.cshtml.cs @@ -0,0 +1,12 @@ +using Microsoft.AspNetCore.Mvc.RazorPages; + +namespace Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo.Pages.Components.Modals +{ + public class IndexModel : PageModel + { + public void OnGet() + { + + } + } +} \ No newline at end of file diff --git a/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/Pages/Components/Navs/Index.cshtml b/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/Pages/Components/Navs/Index.cshtml new file mode 100644 index 0000000000..3bda329ce3 --- /dev/null +++ b/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/Pages/Components/Navs/Index.cshtml @@ -0,0 +1,7 @@ +@page +@using Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo.Views.Components.Themes.Shared.Demos.NavsDemo +@model Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo.Pages.Components.Navs.IndexModel +

    Navs

    +

    Based on Bootstrap Navs.

    + +@await Component.InvokeAsync(typeof(NavsDemoViewComponent)) \ No newline at end of file diff --git a/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/Pages/Components/Navs/Index.cshtml.cs b/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/Pages/Components/Navs/Index.cshtml.cs new file mode 100644 index 0000000000..e9f901052f --- /dev/null +++ b/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/Pages/Components/Navs/Index.cshtml.cs @@ -0,0 +1,12 @@ +using Microsoft.AspNetCore.Mvc.RazorPages; + +namespace Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo.Pages.Components.Navs +{ + public class IndexModel : PageModel + { + public void OnGet() + { + + } + } +} \ No newline at end of file diff --git a/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/Pages/Components/Popovers/Index.cshtml b/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/Pages/Components/Popovers/Index.cshtml new file mode 100644 index 0000000000..ebc878c511 --- /dev/null +++ b/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/Pages/Components/Popovers/Index.cshtml @@ -0,0 +1,7 @@ +@page +@using Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo.Views.Components.Themes.Shared.Demos.PopoversDemo +@model Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo.Pages.Components.Popovers.IndexModel +

    Popovers

    +

    Based on Bootstrap Popovers.

    + +@await Component.InvokeAsync(typeof(PopoversDemoViewComponent)) \ No newline at end of file diff --git a/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/Pages/Components/Popovers/Index.cshtml.cs b/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/Pages/Components/Popovers/Index.cshtml.cs new file mode 100644 index 0000000000..6bb055517b --- /dev/null +++ b/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/Pages/Components/Popovers/Index.cshtml.cs @@ -0,0 +1,12 @@ +using Microsoft.AspNetCore.Mvc.RazorPages; + +namespace Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo.Pages.Components.Popovers +{ + public class IndexModel : PageModel + { + public void OnGet() + { + + } + } +} \ No newline at end of file diff --git a/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/Pages/Components/ProgressBars/Index.cshtml b/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/Pages/Components/ProgressBars/Index.cshtml new file mode 100644 index 0000000000..b2c51f412e --- /dev/null +++ b/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/Pages/Components/ProgressBars/Index.cshtml @@ -0,0 +1,7 @@ +@page +@using Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo.Views.Components.Themes.Shared.Demos.ProgressBarsDemo +@model Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo.Pages.Components.ProgressBars.IndexModel +

    Progress Bars

    +

    Based on Bootstrap Progress Bars.

    + +@await Component.InvokeAsync(typeof(ProgressBarsDemoViewComponent)) \ No newline at end of file diff --git a/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/Pages/Components/ProgressBars/Index.cshtml.cs b/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/Pages/Components/ProgressBars/Index.cshtml.cs new file mode 100644 index 0000000000..e2be5ad928 --- /dev/null +++ b/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/Pages/Components/ProgressBars/Index.cshtml.cs @@ -0,0 +1,12 @@ +using Microsoft.AspNetCore.Mvc.RazorPages; + +namespace Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo.Pages.Components.ProgressBars +{ + public class IndexModel : PageModel + { + public void OnGet() + { + + } + } +} \ No newline at end of file diff --git a/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/Pages/Components/Tables/Index.cshtml b/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/Pages/Components/Tables/Index.cshtml new file mode 100644 index 0000000000..f45ccb2f47 --- /dev/null +++ b/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/Pages/Components/Tables/Index.cshtml @@ -0,0 +1,7 @@ +@page +@using Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo.Views.Components.Themes.Shared.Demos.TablesDemo +@model Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo.Pages.Components.Tables.IndexModel +

    Tables

    +

    Based on Bootstrap Tables.

    + +@await Component.InvokeAsync(typeof(TablesDemoViewComponent)) \ No newline at end of file diff --git a/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/Pages/Components/Tables/Index.cshtml.cs b/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/Pages/Components/Tables/Index.cshtml.cs new file mode 100644 index 0000000000..84289beeff --- /dev/null +++ b/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/Pages/Components/Tables/Index.cshtml.cs @@ -0,0 +1,12 @@ +using Microsoft.AspNetCore.Mvc.RazorPages; + +namespace Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo.Pages.Components.Tables +{ + public class IndexModel : PageModel + { + public void OnGet() + { + + } + } +} \ No newline at end of file diff --git a/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/Pages/Components/Tabs/Index.cshtml b/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/Pages/Components/Tabs/Index.cshtml new file mode 100644 index 0000000000..7c5cff5970 --- /dev/null +++ b/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/Pages/Components/Tabs/Index.cshtml @@ -0,0 +1,7 @@ +@page +@using Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo.Views.Components.Themes.Shared.Demos.TabsDemo +@model Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo.Pages.Components.Tabs.IndexModel +

    Tabs

    +

    Based on Bootstrap tab.

    + +@await Component.InvokeAsync(typeof(TabsDemoViewComponent)) \ No newline at end of file diff --git a/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/Pages/Components/Tabs/Index.cshtml.cs b/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/Pages/Components/Tabs/Index.cshtml.cs new file mode 100644 index 0000000000..62f727d427 --- /dev/null +++ b/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/Pages/Components/Tabs/Index.cshtml.cs @@ -0,0 +1,12 @@ +using Microsoft.AspNetCore.Mvc.RazorPages; + +namespace Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo.Pages.Components.Tabs +{ + public class IndexModel : PageModel + { + public void OnGet() + { + + } + } +} \ No newline at end of file diff --git a/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/Pages/Components/Tooltips/Index.cshtml b/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/Pages/Components/Tooltips/Index.cshtml new file mode 100644 index 0000000000..617bb37582 --- /dev/null +++ b/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/Pages/Components/Tooltips/Index.cshtml @@ -0,0 +1,7 @@ +@page +@using Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo.Views.Components.Themes.Shared.Demos.TooltipsDemo +@model Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo.Pages.Components.Tooltips.IndexModel +

    Tooltips

    +

    Based on Bootstrap Tooltips.

    + +@await Component.InvokeAsync(typeof(TooltipsDemoViewComponent)) \ No newline at end of file diff --git a/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/Pages/Components/Tooltips/Index.cshtml.cs b/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/Pages/Components/Tooltips/Index.cshtml.cs new file mode 100644 index 0000000000..8f5170c171 --- /dev/null +++ b/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/Pages/Components/Tooltips/Index.cshtml.cs @@ -0,0 +1,12 @@ +using Microsoft.AspNetCore.Mvc.RazorPages; + +namespace Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo.Pages.Components.Tooltips +{ + public class IndexModel : PageModel + { + public void OnGet() + { + + } + } +} \ No newline at end of file From 7714ba2139039067679bad7e663141323c61183a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ahmet=20=C3=87otur?= Date: Mon, 2 Mar 2020 15:08:27 +0300 Subject: [PATCH 39/56] Update GridsDemoViewComponent.cs --- .../Shared/Demos/GridsDemo/GridsDemoViewComponent.cs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/Demos/GridsDemo/GridsDemoViewComponent.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/Demos/GridsDemo/GridsDemoViewComponent.cs index 8a7f82b081..99f99186cd 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/Demos/GridsDemo/GridsDemoViewComponent.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/Demos/GridsDemo/GridsDemoViewComponent.cs @@ -3,3 +3,14 @@ using Volo.Abp.AspNetCore.Mvc.UI.Widgets; namespace Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo.Views.Components.Themes.Shared.Demos.GridsDemo { + [Widget] + public class GridsDemoViewComponent : AbpViewComponent + { + public const string ViewPath = "/Views/Components/Themes/Shared/Demos/GridsDemo/Default.cshtml"; + + public IViewComponentResult Invoke() + { + return View(ViewPath); + } + } +} \ No newline at end of file From 40e8165d1d8c04eb9c50589d42e95d28ad84e536 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ak=C4=B1n=20Sabri=20=C3=87am?= Date: Mon, 2 Mar 2020 17:01:15 +0300 Subject: [PATCH 40/56] refactored codes --- .../Volo/Blogging/Posts/IPostAppService.cs | 2 +- .../Volo/Blogging/Posts/PostDto.cs | 27 ------------------- .../Volo/Blogging/Posts/PostWithDetailsDto.cs | 1 + .../BloggingApplicationAutoMapperProfile.cs | 1 - .../Volo/Blogging/Posts/PostAppService.cs | 27 ++++++++----------- .../Volo/Blogging/Blogs/BlogConsts.cs | 1 + .../Volo/Blogging/Posts/IPostRepository.cs | 2 ++ .../Blogging/Posts/EfCorePostRepository.cs | 13 +++++++++ .../Volo/Blogging/PostsController.cs | 6 ++--- .../Blogging/Posts/MongoPostRepository.cs | 5 ++++ 10 files changed, 37 insertions(+), 48 deletions(-) delete mode 100644 modules/blogging/src/Volo.Blogging.Application.Contracts/Volo/Blogging/Posts/PostDto.cs diff --git a/modules/blogging/src/Volo.Blogging.Application.Contracts/Volo/Blogging/Posts/IPostAppService.cs b/modules/blogging/src/Volo.Blogging.Application.Contracts/Volo/Blogging/Posts/IPostAppService.cs index b28c184ce7..55b64d29de 100644 --- a/modules/blogging/src/Volo.Blogging.Application.Contracts/Volo/Blogging/Posts/IPostAppService.cs +++ b/modules/blogging/src/Volo.Blogging.Application.Contracts/Volo/Blogging/Posts/IPostAppService.cs @@ -9,7 +9,7 @@ namespace Volo.Blogging.Posts { Task> GetListByBlogIdAndTagName(Guid blogId, string tagName); - Task> GetOrderedListPostsByTime(); + Task> GetTimeOrderedListAsync(Guid blogId); Task GetForReadingAsync(GetPostInput input); diff --git a/modules/blogging/src/Volo.Blogging.Application.Contracts/Volo/Blogging/Posts/PostDto.cs b/modules/blogging/src/Volo.Blogging.Application.Contracts/Volo/Blogging/Posts/PostDto.cs deleted file mode 100644 index a4d4364a96..0000000000 --- a/modules/blogging/src/Volo.Blogging.Application.Contracts/Volo/Blogging/Posts/PostDto.cs +++ /dev/null @@ -1,27 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using Volo.Abp.Application.Dtos; - -namespace Volo.Blogging.Posts -{ - public class PostDto : FullAuditedEntityDto - { - public Guid BlogId { get; set; } - - public string Title { get; set; } - - public string CoverImage { get; set; } - - public string Url { get; set; } - - public string Content { get; set; } - - public string UserName { get; set; } - - public int ReadCount { get; set; } - - public int CommentCount { get; set; } - - } -} diff --git a/modules/blogging/src/Volo.Blogging.Application.Contracts/Volo/Blogging/Posts/PostWithDetailsDto.cs b/modules/blogging/src/Volo.Blogging.Application.Contracts/Volo/Blogging/Posts/PostWithDetailsDto.cs index 08dde7e019..ff831031aa 100644 --- a/modules/blogging/src/Volo.Blogging.Application.Contracts/Volo/Blogging/Posts/PostWithDetailsDto.cs +++ b/modules/blogging/src/Volo.Blogging.Application.Contracts/Volo/Blogging/Posts/PostWithDetailsDto.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Reflection; using JetBrains.Annotations; using Volo.Abp.Application.Dtos; using Volo.Blogging.Tagging.Dtos; diff --git a/modules/blogging/src/Volo.Blogging.Application/Volo/Blogging/BloggingApplicationAutoMapperProfile.cs b/modules/blogging/src/Volo.Blogging.Application/Volo/Blogging/BloggingApplicationAutoMapperProfile.cs index a018a318ae..b9e3cf0dea 100644 --- a/modules/blogging/src/Volo.Blogging.Application/Volo/Blogging/BloggingApplicationAutoMapperProfile.cs +++ b/modules/blogging/src/Volo.Blogging.Application/Volo/Blogging/BloggingApplicationAutoMapperProfile.cs @@ -18,7 +18,6 @@ namespace Volo.Blogging CreateMap(); CreateMap(); CreateMap().Ignore(x=>x.Writer).Ignore(x=>x.CommentCount).Ignore(x=>x.Tags); - CreateMap().Ignore(x => x.UserName).Ignore(x => x.CommentCount); CreateMap().Ignore(x => x.Writer); CreateMap(); } diff --git a/modules/blogging/src/Volo.Blogging.Application/Volo/Blogging/Posts/PostAppService.cs b/modules/blogging/src/Volo.Blogging.Application/Volo/Blogging/Posts/PostAppService.cs index d0bd0802e5..44b8e9866e 100644 --- a/modules/blogging/src/Volo.Blogging.Application/Volo/Blogging/Posts/PostAppService.cs +++ b/modules/blogging/src/Volo.Blogging.Application/Volo/Blogging/Posts/PostAppService.cs @@ -44,11 +44,6 @@ namespace Volo.Blogging.Posts postDtos = await FilterPostsByTag(postDtos, tag); } - foreach (var postDto in postDtos) - { - postDto.CommentCount = await _commentRepository.GetCommentCountOfPostAsync(postDto.Id); - } - foreach (var postDto in postDtos) { if (postDto.CreatorId.HasValue) @@ -68,26 +63,26 @@ namespace Volo.Blogging.Posts } } } - + return new ListResultDto(postDtos); } - public async Task> GetOrderedListPostsByTime() + public async Task> GetTimeOrderedListAsync(Guid blogId) { - var posts = (await _postRepository.GetListAsync()).OrderByDescending(x => x.CreationTime).ToList(); - var postDtos = new List(ObjectMapper.Map, List>(posts)); + var posts = await _postRepository.GetOrderedList(blogId); + + var postDtos = new List(ObjectMapper.Map, List>(posts)); foreach (var postDto in postDtos) { - if (postDto.CreatorId.HasValue) + var creatorUser = await UserLookupService.FindByIdAsync(postDto.CreatorId.Value); + if (creatorUser != null) { - var creatorUser = await UserLookupService.FindByIdAsync(postDto.CreatorId.Value); - - postDto.UserName = ObjectMapper.Map(creatorUser).UserName; + postDto.Writer = ObjectMapper.Map(creatorUser); } } - return new ListResultDto(postDtos); + return new ListResultDto(postDtos); } public async Task GetForReadingAsync(GetPostInput input) @@ -190,7 +185,7 @@ namespace Volo.Blogging.Posts { var postList = await _postRepository.GetListAsync(); - if (postList.Where(p => p.Url == url).WhereIf(existingPost != null, p => existingPost.Id != p.Id).Any()) + if (postList.Where(p => p.Url == url).WhereIf(existingPost != null, p => existingPost.Id != p.Id).Any()) { return url + "-" + Guid.NewGuid().ToString().Substring(0, 5); } @@ -270,7 +265,7 @@ namespace Volo.Blogging.Posts private Task> FilterPostsByTag(IEnumerable allPostDtos, Tag tag) { var filteredPostDtos = allPostDtos.Where(p => p.Tags?.Any(t => t.Id == tag.Id) ?? false).ToList(); - + return Task.FromResult(filteredPostDtos); } } diff --git a/modules/blogging/src/Volo.Blogging.Domain.Shared/Volo/Blogging/Blogs/BlogConsts.cs b/modules/blogging/src/Volo.Blogging.Domain.Shared/Volo/Blogging/Blogs/BlogConsts.cs index b9613b5a4e..bb107e7971 100644 --- a/modules/blogging/src/Volo.Blogging.Domain.Shared/Volo/Blogging/Blogs/BlogConsts.cs +++ b/modules/blogging/src/Volo.Blogging.Domain.Shared/Volo/Blogging/Blogs/BlogConsts.cs @@ -8,5 +8,6 @@ public const int MaxDescriptionLength = 1024; + public const string BlogName = "blog"; } } diff --git a/modules/blogging/src/Volo.Blogging.Domain/Volo/Blogging/Posts/IPostRepository.cs b/modules/blogging/src/Volo.Blogging.Domain/Volo/Blogging/Posts/IPostRepository.cs index d38cd5c0d7..02bd68a6b0 100644 --- a/modules/blogging/src/Volo.Blogging.Domain/Volo/Blogging/Posts/IPostRepository.cs +++ b/modules/blogging/src/Volo.Blogging.Domain/Volo/Blogging/Posts/IPostRepository.cs @@ -10,5 +10,7 @@ namespace Volo.Blogging.Posts Task> GetPostsByBlogId(Guid id); Task GetPostByUrl(Guid blogId, string url); + + Task> GetOrderedList(Guid blogId,bool descending = false); } } diff --git a/modules/blogging/src/Volo.Blogging.EntityFrameworkCore/Volo/Blogging/Posts/EfCorePostRepository.cs b/modules/blogging/src/Volo.Blogging.EntityFrameworkCore/Volo/Blogging/Posts/EfCorePostRepository.cs index fd4bec2de4..01c5652902 100644 --- a/modules/blogging/src/Volo.Blogging.EntityFrameworkCore/Volo/Blogging/Posts/EfCorePostRepository.cs +++ b/modules/blogging/src/Volo.Blogging.EntityFrameworkCore/Volo/Blogging/Posts/EfCorePostRepository.cs @@ -35,6 +35,19 @@ namespace Volo.Blogging.Posts return post; } + public async Task> GetOrderedList(Guid blogId,bool descending = false) + { + if (!descending) + { + return await DbSet.Where(x=>x.BlogId==blogId).OrderByDescending(x => x.CreationTime).ToListAsync(); + } + else + { + return await DbSet.Where(x => x.BlogId == blogId).OrderBy(x => x.CreationTime).ToListAsync(); + } + + } + public override IQueryable WithDetails() { return GetQueryable().IncludeDetails(); diff --git a/modules/blogging/src/Volo.Blogging.HttpApi/Volo/Blogging/PostsController.cs b/modules/blogging/src/Volo.Blogging.HttpApi/Volo/Blogging/PostsController.cs index c320744f96..332f60c256 100644 --- a/modules/blogging/src/Volo.Blogging.HttpApi/Volo/Blogging/PostsController.cs +++ b/modules/blogging/src/Volo.Blogging.HttpApi/Volo/Blogging/PostsController.cs @@ -27,11 +27,11 @@ namespace Volo.Blogging return _postAppService.GetListByBlogIdAndTagName(blogId, tagName); } - [HttpGet] - public Task> GetOrderedListPostsByTime() + [Route("{blogId}/all/by-time")] + public Task> GetTimeOrderedListAsync(Guid blogId) { - return _postAppService.GetOrderedListPostsByTime(); + return _postAppService.GetTimeOrderedListAsync(blogId); } [HttpGet] diff --git a/modules/blogging/src/Volo.Blogging.MongoDB/Volo/Blogging/Posts/MongoPostRepository.cs b/modules/blogging/src/Volo.Blogging.MongoDB/Volo/Blogging/Posts/MongoPostRepository.cs index 52a614df90..223aa8968e 100644 --- a/modules/blogging/src/Volo.Blogging.MongoDB/Volo/Blogging/Posts/MongoPostRepository.cs +++ b/modules/blogging/src/Volo.Blogging.MongoDB/Volo/Blogging/Posts/MongoPostRepository.cs @@ -32,5 +32,10 @@ namespace Volo.Blogging.Posts return post; } + + public Task> GetOrderedList(Guid blogId, bool @descending = false) + { + throw new NotImplementedException(); + } } } From 5c472108ca313be56be6007ee2725166252a7651 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?= Date: Mon, 2 Mar 2020 17:18:45 +0300 Subject: [PATCH 41/56] Remove unused namespaces --- .../CrossPlatformParameterTypeComparer.cs | 2 -- .../Client/DynamicProxying/IParameterTypeComparer.cs | 9 +++------ .../Http/Client/DynamicProxying/ParameterTypeComparer.cs | 2 -- 3 files changed, 3 insertions(+), 10 deletions(-) diff --git a/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/DynamicProxying/CrossPlatformParameterTypeComparer.cs b/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/DynamicProxying/CrossPlatformParameterTypeComparer.cs index e9142ffe3f..d6f3b3d1ec 100644 --- a/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/DynamicProxying/CrossPlatformParameterTypeComparer.cs +++ b/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/DynamicProxying/CrossPlatformParameterTypeComparer.cs @@ -1,7 +1,5 @@ using System; -using System.Collections.Generic; using System.Reflection; -using System.Text; using Volo.Abp.DependencyInjection; using Volo.Abp.Http.Modeling; diff --git a/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/DynamicProxying/IParameterTypeComparer.cs b/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/DynamicProxying/IParameterTypeComparer.cs index 079029bf93..2aed060b01 100644 --- a/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/DynamicProxying/IParameterTypeComparer.cs +++ b/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/DynamicProxying/IParameterTypeComparer.cs @@ -1,7 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Reflection; -using System.Text; +using System.Reflection; using Volo.Abp.Http.Modeling; namespace Volo.Abp.Http.Client.DynamicProxying @@ -11,9 +8,9 @@ namespace Volo.Abp.Http.Client.DynamicProxying /// /// Compares the given parameters. /// - /// The parameter description retreived from the server (depends on the server's runtime) + /// The parameter description retrieved from the server (depends on the server's runtime) /// The local parameter info (depends on the client's runtime) /// - public bool TypeMatches(MethodParameterApiDescriptionModel actionParameter, ParameterInfo methodParameter); + bool TypeMatches(MethodParameterApiDescriptionModel actionParameter, ParameterInfo methodParameter); } } diff --git a/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/DynamicProxying/ParameterTypeComparer.cs b/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/DynamicProxying/ParameterTypeComparer.cs index 6551ba3108..cb714fd5aa 100644 --- a/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/DynamicProxying/ParameterTypeComparer.cs +++ b/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/DynamicProxying/ParameterTypeComparer.cs @@ -1,7 +1,5 @@ using System; -using System.Collections.Generic; using System.Reflection; -using System.Text; using Volo.Abp.Http.Modeling; namespace Volo.Abp.Http.Client.DynamicProxying From da6f72333ee12eddc6ab55b6b9080d27b7a4bfa7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ak=C4=B1n=20Sabri=20=C3=87am?= Date: Mon, 2 Mar 2020 17:19:14 +0300 Subject: [PATCH 42/56] code fixed --- .../Volo/Blogging/Posts/PostWithDetailsDto.cs | 1 - .../Volo/Blogging/Blogs/BlogConsts.cs | 2 -- .../Volo/Blogging/Posts/MongoPostRepository.cs | 9 +++++++-- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/modules/blogging/src/Volo.Blogging.Application.Contracts/Volo/Blogging/Posts/PostWithDetailsDto.cs b/modules/blogging/src/Volo.Blogging.Application.Contracts/Volo/Blogging/Posts/PostWithDetailsDto.cs index ff831031aa..08dde7e019 100644 --- a/modules/blogging/src/Volo.Blogging.Application.Contracts/Volo/Blogging/Posts/PostWithDetailsDto.cs +++ b/modules/blogging/src/Volo.Blogging.Application.Contracts/Volo/Blogging/Posts/PostWithDetailsDto.cs @@ -1,6 +1,5 @@ using System; using System.Collections.Generic; -using System.Reflection; using JetBrains.Annotations; using Volo.Abp.Application.Dtos; using Volo.Blogging.Tagging.Dtos; diff --git a/modules/blogging/src/Volo.Blogging.Domain.Shared/Volo/Blogging/Blogs/BlogConsts.cs b/modules/blogging/src/Volo.Blogging.Domain.Shared/Volo/Blogging/Blogs/BlogConsts.cs index bb107e7971..502a4364e7 100644 --- a/modules/blogging/src/Volo.Blogging.Domain.Shared/Volo/Blogging/Blogs/BlogConsts.cs +++ b/modules/blogging/src/Volo.Blogging.Domain.Shared/Volo/Blogging/Blogs/BlogConsts.cs @@ -7,7 +7,5 @@ public const int MaxShortNameLength = 32; public const int MaxDescriptionLength = 1024; - - public const string BlogName = "blog"; } } diff --git a/modules/blogging/src/Volo.Blogging.MongoDB/Volo/Blogging/Posts/MongoPostRepository.cs b/modules/blogging/src/Volo.Blogging.MongoDB/Volo/Blogging/Posts/MongoPostRepository.cs index 223aa8968e..16dfdd1d74 100644 --- a/modules/blogging/src/Volo.Blogging.MongoDB/Volo/Blogging/Posts/MongoPostRepository.cs +++ b/modules/blogging/src/Volo.Blogging.MongoDB/Volo/Blogging/Posts/MongoPostRepository.cs @@ -33,9 +33,14 @@ namespace Volo.Blogging.Posts return post; } - public Task> GetOrderedList(Guid blogId, bool @descending = false) + public async Task> GetOrderedList(Guid blogId, bool @descending = false) { - throw new NotImplementedException(); + if (!descending) + { + return await GetMongoQueryable().Where(x => x.BlogId == blogId).OrderByDescending(x => x.CreationTime).ToListAsync(); + } + return await GetMongoQueryable().Where(x => x.BlogId == blogId).OrderByDescending(x => x.CreationTime).ToListAsync(); + } } } From fc1b3e72ff7080c307baf85b97cf9b3c77c139f7 Mon Sep 17 00:00:00 2001 From: liangshiwei Date: Mon, 2 Mar 2020 22:26:44 +0800 Subject: [PATCH 43/56] Improve cli custom template source feature --- docs/en/CLI.md | 2 +- docs/zh-Hans/CLI.md | 2 +- .../Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/NewCommand.cs | 7 ++++--- .../Abp/Cli/Commands/Services/SourceCodeDownloadService.cs | 2 +- .../Volo/Abp/Cli/ProjectBuilding/ModuleProjectBuilder.cs | 2 ++ .../Volo/Abp/Cli/ProjectBuilding/TemplateProjectBuilder.cs | 2 ++ 6 files changed, 11 insertions(+), 6 deletions(-) diff --git a/docs/en/CLI.md b/docs/en/CLI.md index d5c1565499..a1c53e0407 100644 --- a/docs/en/CLI.md +++ b/docs/en/CLI.md @@ -55,7 +55,7 @@ abp new Acme.BookStore * `--no-ui`: Specifies to not include the UI. This makes possible to create service-only modules (a.k.a. microservices - without UI). * `--output-folder` or `-o`: Specifies the output folder. Default value is the current directory. * `--version` or `-v`: Specifies the ABP & template version. It can be a [release tag](https://github.com/abpframework/abp/releases) or a [branch name](https://github.com/abpframework/abp/branches). Uses the latest release if not specified. Most of the times, you will want to use the latest version. -* `--template-source`: Specifies a custom template source to use to build the project. Local and network sources can be used(Like `D\localTemplate` or `https://.zip`). +* `--template-source` or `-ts`: Specifies a custom template source to use to build the project. Local and network sources can be used(Like `D\localTemplate` or `https://.zip`). ### add-package diff --git a/docs/zh-Hans/CLI.md b/docs/zh-Hans/CLI.md index 41332d4fcd..69ca39880a 100644 --- a/docs/zh-Hans/CLI.md +++ b/docs/zh-Hans/CLI.md @@ -55,7 +55,7 @@ abp new Acme.BookStore * `--no-ui`: 不包含UI.仅创建服务模块(也称为微服务 - 没有UI). * `--output-folder` 或者 `-o`: 指定输出文件夹,默认是当前目录. * `--version` 或者 `-v`: 指定ABP和模板的版本.它可以是 [release tag](https://github.com/abpframework/abp/releases) 或者 [branch name](https://github.com/abpframework/abp/branches). 如果没有指定,则使用最新版本.大多数情况下,您会希望使用最新的版本. -* `--template-source`: 指定自定义模板源用于生成项目,可以使用本地源和网络源(例如 `D\localTemplate` 或 `https://.zip`). +* `--template-source` 或者 `-ts`: 指定自定义模板源用于生成项目,可以使用本地源和网络源(例如 `D\localTemplate` 或 `https://.zip`). ### add-package diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/NewCommand.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/NewCommand.cs index 050ee4b51f..f25a4ad89f 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/NewCommand.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/NewCommand.cs @@ -79,7 +79,7 @@ namespace Volo.Abp.Cli.Commands Logger.LogInformation("GitHub Local Repository Path: " + gitHubLocalRepositoryPath); } - var templateSource = commandLineArgs.Options.GetOrNull(Options.TemplateSource.Long); + var templateSource = commandLineArgs.Options.GetOrNull(Options.TemplateSource.Short, Options.TemplateSource.Long); if (templateSource != null) { Logger.LogInformation("Template Source: " + templateSource); @@ -165,11 +165,11 @@ namespace Volo.Abp.Cli.Commands sb.AppendLine("-d|--database-provider (if supported by the template)"); sb.AppendLine("-o|--output-folder (default: current folder)"); sb.AppendLine("-v|--version (default: latest version)"); + sb.AppendLine("-ts|--template-source (your local or network abp template source)"); sb.AppendLine("--tiered (if supported by the template)"); sb.AppendLine("--no-ui (if supported by the template)"); sb.AppendLine("--separate-identity-server (if supported by the template)"); sb.AppendLine("--local-framework-ref --abp-path (keeps local references to projects instead of replacing with NuGet package references)"); - sb.AppendLine("--template-source (your local or network abp template source)"); sb.AppendLine(""); sb.AppendLine("Examples:"); sb.AppendLine(""); @@ -181,8 +181,8 @@ namespace Volo.Abp.Cli.Commands sb.AppendLine(" abp new Acme.BookStore -d mongodb -o d:\\my-project"); sb.AppendLine(" abp new Acme.BookStore -t module"); sb.AppendLine(" abp new Acme.BookStore -t module --no-ui"); + sb.AppendLine(" abp new Acme.BookStore -ts \"D:\\localTemplate\\abp\""); sb.AppendLine(" abp new Acme.BookStore --local-framework-ref --abp-path \"D:\\github\\abp\""); - sb.AppendLine(" abp new Acme.BookStore --template-url \"D:\\localTemplate\\abp\""); sb.AppendLine(""); sb.AppendLine("See the documentation for more info: https://docs.abp.io/en/abp/latest/CLI"); @@ -283,6 +283,7 @@ namespace Volo.Abp.Cli.Commands public static class TemplateSource { + public const string Short = "ts"; public const string Long = "template-source"; } } diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/Services/SourceCodeDownloadService.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/Services/SourceCodeDownloadService.cs index 7bb375db93..7c8d068e1e 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/Services/SourceCodeDownloadService.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/Services/SourceCodeDownloadService.cs @@ -38,7 +38,7 @@ namespace Volo.Abp.Cli.Commands.Services version, DatabaseProvider.NotSpecified, UiFramework.NotSpecified, - MobileApp.None, + null, gitHubLocalRepositoryPath, null, options diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/ModuleProjectBuilder.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/ModuleProjectBuilder.cs index 48f109e1d3..6a7132769a 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/ModuleProjectBuilder.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/ModuleProjectBuilder.cs @@ -83,6 +83,8 @@ namespace Volo.Abp.Cli.ProjectBuilding !x.Key.Equals(NewCommand.Options.OutputFolder.Short, StringComparison.InvariantCultureIgnoreCase)) .Where(x => !x.Key.Equals(NewCommand.Options.Version.Long, StringComparison.InvariantCultureIgnoreCase) && !x.Key.Equals(NewCommand.Options.Version.Short, StringComparison.InvariantCultureIgnoreCase)) + .Where(x => !x.Key.Equals(NewCommand.Options.TemplateSource.Short, StringComparison.InvariantCultureIgnoreCase) && + !x.Key.Equals(NewCommand.Options.TemplateSource.Long, StringComparison.InvariantCultureIgnoreCase)) .Select(x => x.Key).ToList(); await CliAnalyticsCollect.CollectAsync(new CliAnalyticsCollectInputDto diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/TemplateProjectBuilder.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/TemplateProjectBuilder.cs index a0f156de7b..f7d9eaf3be 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/TemplateProjectBuilder.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/TemplateProjectBuilder.cs @@ -93,6 +93,8 @@ namespace Volo.Abp.Cli.ProjectBuilding !x.Key.Equals(NewCommand.Options.Mobile.Short, StringComparison.InvariantCultureIgnoreCase)) .Where(x => !x.Key.Equals(NewCommand.Options.Version.Long, StringComparison.InvariantCultureIgnoreCase) && !x.Key.Equals(NewCommand.Options.Version.Short, StringComparison.InvariantCultureIgnoreCase)) + .Where(x => !x.Key.Equals(NewCommand.Options.TemplateSource.Short, StringComparison.InvariantCultureIgnoreCase) && + !x.Key.Equals(NewCommand.Options.TemplateSource.Long, StringComparison.InvariantCultureIgnoreCase)) .Select(x => x.Key).ToList(); await CliAnalyticsCollect.CollectAsync(new CliAnalyticsCollectInputDto From d82349e0f8dc6bc0dff4d3b05da820abb2e225fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ak=C4=B1n=20Sabri=20=C3=87am?= Date: Mon, 2 Mar 2020 17:28:24 +0300 Subject: [PATCH 44/56] Updated repository --- .../Volo/Blogging/Posts/MongoPostRepository.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/blogging/src/Volo.Blogging.MongoDB/Volo/Blogging/Posts/MongoPostRepository.cs b/modules/blogging/src/Volo.Blogging.MongoDB/Volo/Blogging/Posts/MongoPostRepository.cs index 16dfdd1d74..723d79e7ad 100644 --- a/modules/blogging/src/Volo.Blogging.MongoDB/Volo/Blogging/Posts/MongoPostRepository.cs +++ b/modules/blogging/src/Volo.Blogging.MongoDB/Volo/Blogging/Posts/MongoPostRepository.cs @@ -39,7 +39,7 @@ namespace Volo.Blogging.Posts { return await GetMongoQueryable().Where(x => x.BlogId == blogId).OrderByDescending(x => x.CreationTime).ToListAsync(); } - return await GetMongoQueryable().Where(x => x.BlogId == blogId).OrderByDescending(x => x.CreationTime).ToListAsync(); + return await GetMongoQueryable().Where(x => x.BlogId == blogId).OrderBy(x => x.CreationTime).ToListAsync(); } } From af720277e78107773e5fc0709a9f3b4f839bf1e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?= Date: Mon, 2 Mar 2020 17:30:09 +0300 Subject: [PATCH 45/56] Remove EnvironmentHelper and IParameterTypeComparer. --- .../DynamicProxying/ApiDescriptionFinder.cs | 23 +++++++--- .../CrossPlatformParameterTypeComparer.cs | 41 ----------------- .../DynamicProxying/EnvironmentHelper.cs | 44 ------------------- .../DynamicProxying/IParameterTypeComparer.cs | 16 ------- .../DynamicProxying/ParameterTypeComparer.cs | 14 ------ 5 files changed, 17 insertions(+), 121 deletions(-) delete mode 100644 framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/DynamicProxying/CrossPlatformParameterTypeComparer.cs delete mode 100644 framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/DynamicProxying/EnvironmentHelper.cs delete mode 100644 framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/DynamicProxying/IParameterTypeComparer.cs delete mode 100644 framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/DynamicProxying/ParameterTypeComparer.cs diff --git a/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/DynamicProxying/ApiDescriptionFinder.cs b/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/DynamicProxying/ApiDescriptionFinder.cs index 6f8b5da376..38e6878bed 100644 --- a/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/DynamicProxying/ApiDescriptionFinder.cs +++ b/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/DynamicProxying/ApiDescriptionFinder.cs @@ -18,8 +18,6 @@ namespace Volo.Abp.Http.Client.DynamicProxying protected IApiDescriptionCache Cache { get; } - protected IParameterTypeComparer ParameterTypeComparer { get; } - private static readonly JsonSerializerSettings SharedJsonSerializerSettings = new JsonSerializerSettings { ContractResolver = new CamelCasePropertyNamesContractResolver() @@ -27,12 +25,10 @@ namespace Volo.Abp.Http.Client.DynamicProxying public ApiDescriptionFinder( IApiDescriptionCache cache, - IDynamicProxyHttpClientFactory httpClientFactory, - IParameterTypeComparer parameterTypeComparer) + IDynamicProxyHttpClientFactory httpClientFactory) { Cache = cache; HttpClientFactory = httpClientFactory; - ParameterTypeComparer = parameterTypeComparer; CancellationTokenProvider = NullCancellationTokenProvider.Instance; } @@ -61,7 +57,7 @@ namespace Volo.Abp.Http.Client.DynamicProxying for (int i = 0; i < methodParameters.Length; i++) { - if (!ParameterTypeComparer.TypeMatches(action.ParametersOnMethod[i], methodParameters[i])) + if (!TypeMatches(action.ParametersOnMethod[i], methodParameters[i])) { found = false; break; @@ -108,5 +104,20 @@ namespace Volo.Abp.Http.Client.DynamicProxying return (ApplicationApiDescriptionModel)result; } } + + protected virtual bool TypeMatches(MethodParameterApiDescriptionModel actionParameter, ParameterInfo methodParameter) + { + return NormalizeTypeName(actionParameter.TypeAsString) == + NormalizeTypeName(methodParameter.ParameterType.GetFullNameWithAssemblyName()); + } + + protected virtual string NormalizeTypeName(string typeName) + { + const string placeholder = "%COREFX%"; + const string netCoreLib = "System.Private.CoreLib"; + const string netFxLib = "mscorlib"; + + return typeName.Replace(netCoreLib, placeholder).Replace(netFxLib, placeholder); + } } } diff --git a/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/DynamicProxying/CrossPlatformParameterTypeComparer.cs b/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/DynamicProxying/CrossPlatformParameterTypeComparer.cs deleted file mode 100644 index d6f3b3d1ec..0000000000 --- a/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/DynamicProxying/CrossPlatformParameterTypeComparer.cs +++ /dev/null @@ -1,41 +0,0 @@ -using System; -using System.Reflection; -using Volo.Abp.DependencyInjection; -using Volo.Abp.Http.Modeling; - -namespace Volo.Abp.Http.Client.DynamicProxying -{ - /// - /// Compares the server-side parameter-type with the local parameter-type considering differences between - /// the .net-core and the traditional .net-framework. - /// Inspired by 'https://github.com/akkadotnet/akka.net/pull/2947/files' - /// - public class CrossPlatformParameterTypeComparer : ParameterTypeComparer, ITransientDependency - { - const string Placeholder = "%COREFX%"; - const string NetCoreLib = "System.Private.CoreLib"; - const string NetFxLib = "mscorlib"; - - static readonly bool runsOnNetFx; - - static CrossPlatformParameterTypeComparer() - { - runsOnNetFx = string.IsNullOrEmpty(EnvironmentHelper.RuntimeNetCoreVersion); - } - - public override bool TypeMatches(MethodParameterApiDescriptionModel actionParameter, ParameterInfo methodParameter) - { - if (runsOnNetFx) - { - // Compare the server's DotnetCore type relative to the current, traditional framework type - // by replacing framework assemblies with an placeholder string. - return actionParameter.TypeAsString.Replace(NetCoreLib, Placeholder) - == methodParameter.ParameterType.GetFullNameWithAssemblyName().Replace(NetFxLib, Placeholder); - } - else - { - return base.TypeMatches(actionParameter, methodParameter); - } - } - } -} diff --git a/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/DynamicProxying/EnvironmentHelper.cs b/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/DynamicProxying/EnvironmentHelper.cs deleted file mode 100644 index 0ed914e419..0000000000 --- a/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/DynamicProxying/EnvironmentHelper.cs +++ /dev/null @@ -1,44 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Reflection; -using System.Text; - -namespace Volo.Abp.Http.Client.DynamicProxying -{ - /// - /// Provide helpers to check the environment where the current ABP app is currently running - /// - static class EnvironmentHelper - { - /// - /// Initializes the class. - /// - static EnvironmentHelper() - { - RuntimeNetCoreVersion = GetNetCoreVersion(); - } - - /// - /// Gets the runtime net core version. - /// - /// - /// If the is null the app is running on a .net Classic environment - /// - public static string RuntimeNetCoreVersion { get; } - - /// - /// Gets the net core version. - /// - static string GetNetCoreVersion() - { - var assembly = typeof(System.Runtime.GCSettings).GetTypeInfo().Assembly; - var assemblyPath = assembly.CodeBase.Split(new[] { '/', '\\' }, StringSplitOptions.RemoveEmptyEntries); - int netCoreAppIndex = Array.IndexOf(assemblyPath, "Microsoft.NETCore.App"); - if (netCoreAppIndex > 0 && netCoreAppIndex < assemblyPath.Length - 2) - { - return assemblyPath[netCoreAppIndex + 1]; - } - return null; - } - } -} diff --git a/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/DynamicProxying/IParameterTypeComparer.cs b/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/DynamicProxying/IParameterTypeComparer.cs deleted file mode 100644 index 2aed060b01..0000000000 --- a/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/DynamicProxying/IParameterTypeComparer.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System.Reflection; -using Volo.Abp.Http.Modeling; - -namespace Volo.Abp.Http.Client.DynamicProxying -{ - public interface IParameterTypeComparer - { - /// - /// Compares the given parameters. - /// - /// The parameter description retrieved from the server (depends on the server's runtime) - /// The local parameter info (depends on the client's runtime) - /// - bool TypeMatches(MethodParameterApiDescriptionModel actionParameter, ParameterInfo methodParameter); - } -} diff --git a/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/DynamicProxying/ParameterTypeComparer.cs b/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/DynamicProxying/ParameterTypeComparer.cs deleted file mode 100644 index cb714fd5aa..0000000000 --- a/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/DynamicProxying/ParameterTypeComparer.cs +++ /dev/null @@ -1,14 +0,0 @@ -using System; -using System.Reflection; -using Volo.Abp.Http.Modeling; - -namespace Volo.Abp.Http.Client.DynamicProxying -{ - public class ParameterTypeComparer : IParameterTypeComparer - { - public virtual bool TypeMatches(MethodParameterApiDescriptionModel actionParameter, ParameterInfo methodParameter) - { - return actionParameter.TypeAsString == methodParameter.ParameterType.GetFullNameWithAssemblyName(); - } - } -} From 2e395f7166972bf8f2721ac996c677885203af56 Mon Sep 17 00:00:00 2001 From: Yunus Emre Kalkan Date: Mon, 2 Mar 2020 17:45:52 +0300 Subject: [PATCH 46/56] Update MongoPostRepository.cs --- .../Volo/Blogging/Posts/MongoPostRepository.cs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/modules/blogging/src/Volo.Blogging.MongoDB/Volo/Blogging/Posts/MongoPostRepository.cs b/modules/blogging/src/Volo.Blogging.MongoDB/Volo/Blogging/Posts/MongoPostRepository.cs index 723d79e7ad..2e7675a898 100644 --- a/modules/blogging/src/Volo.Blogging.MongoDB/Volo/Blogging/Posts/MongoPostRepository.cs +++ b/modules/blogging/src/Volo.Blogging.MongoDB/Volo/Blogging/Posts/MongoPostRepository.cs @@ -35,12 +35,14 @@ namespace Volo.Blogging.Posts public async Task> GetOrderedList(Guid blogId, bool @descending = false) { + var query = GetMongoQueryable().Where(x => x.BlogId == blogId); + if (!descending) { - return await GetMongoQueryable().Where(x => x.BlogId == blogId).OrderByDescending(x => x.CreationTime).ToListAsync(); + return await query.OrderBy(x => x.CreationTime).ToListAsync(); } - return await GetMongoQueryable().Where(x => x.BlogId == blogId).OrderBy(x => x.CreationTime).ToListAsync(); - + + return await query.OrderByDescending(x => x.CreationTime).ToListAsync(); } } } From 38e2c7212171a91ca724cd848f7b55e1081c429d Mon Sep 17 00:00:00 2001 From: maliming Date: Tue, 3 Mar 2020 08:31:28 +0800 Subject: [PATCH 47/56] Revert "Use `IHttpClientFactory` instead of manually creating a `HttpClient`" --- .../Volo.Abp.IdentityModel.csproj | 1 - .../IdentityModelAuthenticationService.cs | 19 ++++++++----------- 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/framework/src/Volo.Abp.IdentityModel/Volo.Abp.IdentityModel.csproj b/framework/src/Volo.Abp.IdentityModel/Volo.Abp.IdentityModel.csproj index ce26fe7bea..3e4ae78b91 100644 --- a/framework/src/Volo.Abp.IdentityModel/Volo.Abp.IdentityModel.csproj +++ b/framework/src/Volo.Abp.IdentityModel/Volo.Abp.IdentityModel.csproj @@ -16,7 +16,6 @@ - diff --git a/framework/src/Volo.Abp.IdentityModel/Volo/Abp/IdentityModel/IdentityModelAuthenticationService.cs b/framework/src/Volo.Abp.IdentityModel/Volo/Abp/IdentityModel/IdentityModelAuthenticationService.cs index 6487f6ce65..ca6e41d60d 100644 --- a/framework/src/Volo.Abp.IdentityModel/Volo/Abp/IdentityModel/IdentityModelAuthenticationService.cs +++ b/framework/src/Volo.Abp.IdentityModel/Volo/Abp/IdentityModel/IdentityModelAuthenticationService.cs @@ -21,15 +21,12 @@ namespace Volo.Abp.IdentityModel public ILogger Logger { get; set; } protected AbpIdentityClientOptions ClientOptions { get; } protected ICancellationTokenProvider CancellationTokenProvider { get; } - protected IHttpClientFactory HttpClientFactory { get; } public IdentityModelAuthenticationService( IOptions options, - ICancellationTokenProvider cancellationTokenProvider, - IHttpClientFactory httpClientFactory) + ICancellationTokenProvider cancellationTokenProvider) { CancellationTokenProvider = cancellationTokenProvider; - HttpClientFactory = httpClientFactory; ClientOptions = options.Value; Logger = NullLogger.Instance; } @@ -98,7 +95,7 @@ namespace Volo.Abp.IdentityModel protected virtual async Task GetDiscoveryResponse( IdentityClientConfiguration configuration) { - using (var httpClient = HttpClientFactory.CreateClient()) + using (var httpClient = new HttpClient()) { return await httpClient.GetDiscoveryDocumentAsync(new DiscoveryDocumentRequest { @@ -112,10 +109,10 @@ namespace Volo.Abp.IdentityModel } protected virtual async Task GetTokenResponse( - DiscoveryDocumentResponse discoveryResponse, + DiscoveryDocumentResponse discoveryResponse, IdentityClientConfiguration configuration) { - using (var httpClient = HttpClientFactory.CreateClient()) + using (var httpClient = new HttpClient()) { switch (configuration.GrantType) { @@ -137,7 +134,7 @@ namespace Volo.Abp.IdentityModel protected virtual Task CreatePasswordTokenRequestAsync(DiscoveryDocumentResponse discoveryResponse, IdentityClientConfiguration configuration) { - var request = new PasswordTokenRequest + var request = new PasswordTokenRequest { Address = discoveryResponse.TokenEndpoint, Scope = configuration.Scope, @@ -152,11 +149,11 @@ namespace Volo.Abp.IdentityModel return Task.FromResult(request); } - protected virtual Task CreateClientCredentialsTokenRequestAsync( - DiscoveryDocumentResponse discoveryResponse, + protected virtual Task CreateClientCredentialsTokenRequestAsync( + DiscoveryDocumentResponse discoveryResponse, IdentityClientConfiguration configuration) { - var request = new ClientCredentialsTokenRequest + var request = new ClientCredentialsTokenRequest { Address = discoveryResponse.TokenEndpoint, Scope = configuration.Scope, From 5616252f7403fd858ec4a133c2ee5bffd5fda88e Mon Sep 17 00:00:00 2001 From: maliming Date: Tue, 3 Mar 2020 15:15:47 +0800 Subject: [PATCH 48/56] Save audit logs even if no action performed in the request. Resolve #2820 --- .../Volo/Abp/Auditing/AuditingManager.cs | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/framework/src/Volo.Abp.Auditing/Volo/Abp/Auditing/AuditingManager.cs b/framework/src/Volo.Abp.Auditing/Volo/Abp/Auditing/AuditingManager.cs index 2a9dd8bf5a..8cc9fb7675 100644 --- a/framework/src/Volo.Abp.Auditing/Volo/Abp/Auditing/AuditingManager.cs +++ b/framework/src/Volo.Abp.Auditing/Volo/Abp/Auditing/AuditingManager.cs @@ -114,20 +114,7 @@ namespace Volo.Abp.Auditing { BeforeSave(saveHandle); - if (ShouldSave(saveHandle.AuditLog)) - { - await _auditingStore.SaveAsync(saveHandle.AuditLog); - } - } - - protected bool ShouldSave(AuditLogInfo auditLog) - { - if (!auditLog.Actions.Any() && !auditLog.EntityChanges.Any()) - { - return false; - } - - return true; + await _auditingStore.SaveAsync(saveHandle.AuditLog); } protected class DisposableSaveHandle : IAuditLogSaveHandle From f1f7102a7cefcba9a3921e3e394b6d349814f3a6 Mon Sep 17 00:00:00 2001 From: liangshiwei Date: Tue, 3 Mar 2020 15:33:54 +0800 Subject: [PATCH 49/56] Fix .sln file --- framework/Volo.Abp.sln | 1 + 1 file changed, 1 insertion(+) diff --git a/framework/Volo.Abp.sln b/framework/Volo.Abp.sln index 46fc917ae7..2c3a970281 100644 --- a/framework/Volo.Abp.sln +++ b/framework/Volo.Abp.sln @@ -266,6 +266,7 @@ EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Volo.Abp.Quartz", "src\Volo.Abp.Quartz\Volo.Abp.Quartz.csproj", "{9467418B-4A9B-4093-9B31-01A9DEF5B372}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Volo.Abp.BackgroundWorkers.Quartz", "src\Volo.Abp.BackgroundWorkers.Quartz\Volo.Abp.BackgroundWorkers.Quartz.csproj", "{CD5770BB-2E0C-4B3C-80E0-21B8CC43DBA9}" +EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo", "src\Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo\Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo.csproj", "{29E42ADB-85F8-44AE-A9B0-078F84C1B866}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo", "test\Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo\Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo.csproj", "{0C498CF2-D052-4BF7-AD35-509A90F69707}" From c086bfe609069bfcbbdb78ab684841afc13f068c Mon Sep 17 00:00:00 2001 From: maliming Date: Tue, 3 Mar 2020 15:39:00 +0800 Subject: [PATCH 50/56] Fix audit unit tests. --- .../Volo/Abp/Auditing/Auditing_Tests.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/framework/test/Volo.Abp.Auditing.Tests/Volo/Abp/Auditing/Auditing_Tests.cs b/framework/test/Volo.Abp.Auditing.Tests/Volo/Abp/Auditing/Auditing_Tests.cs index 9837ca3ac2..502ba6dcc8 100644 --- a/framework/test/Volo.Abp.Auditing.Tests/Volo/Abp/Auditing/Auditing_Tests.cs +++ b/framework/test/Volo.Abp.Auditing.Tests/Volo/Abp/Auditing/Auditing_Tests.cs @@ -118,7 +118,7 @@ namespace Volo.Abp.Auditing } #pragma warning disable 4014 - _auditingStore.DidNotReceive().SaveAsync(Arg.Any()); + _auditingStore.Received().SaveAsync(Arg.Is(a => !a.EntityChanges.Any())); #pragma warning restore 4014 } @@ -172,7 +172,7 @@ namespace Volo.Abp.Auditing [Fact] - public virtual async Task Should_Not_Write_AuditLog_If_There_No_Action_And_No_EntityChanges() + public virtual async Task Should_Write_AuditLog_If_There_No_Action_And_No_EntityChanges() { using (var scope = _auditingManager.BeginScope()) { @@ -180,7 +180,7 @@ namespace Volo.Abp.Auditing } #pragma warning disable 4014 - _auditingStore.DidNotReceive().SaveAsync(Arg.Any()); + _auditingStore.Received().SaveAsync(Arg.Any()); #pragma warning restore 4014 } From 23e6018278188b7d509b298a1f6b52766324a4db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?= Date: Tue, 3 Mar 2020 11:01:40 +0300 Subject: [PATCH 51/56] Renamed Volo.Abp.Http.Client.IdentityModel.Relay to Volo.Abp.Http.Client.IdentityModel.Web. Also fixed depending projects. --- framework/Volo.Abp.sln | 15 ++++++++--- .../Relay/AbpHttpClientIdentityModelModule.cs | 13 ---------- .../FodyWeavers.xml | 0 .../FodyWeavers.xsd | 0 .../Properties/launchSettings.json | 0 ....Abp.Http.Client.IdentityModel.Web.csproj} | 4 +-- .../AbpHttpClientIdentityModelWebModule.cs | 12 +++++++++ ...elRemoteServiceHttpClientAuthenticator.cs} | 6 ++--- ...delRemoteServiceHttpClientAuthenticator.cs | 1 - .../IdentityModel/AbpIdentityModelModule.cs | 2 ++ ...Http.Client.IdentityModel.Web.Tests.csproj | 16 ++++++++++++ ...AbpHttpClientIdentityModelWebTestModule.cs | 10 +++++++ ...oteServiceHttpClientAuthenticator_Tests.cs | 26 +++++++++++++++++++ .../ClientSimulationWebModule.cs | 2 ++ .../Volo.ClientSimulation.Web.csproj | 1 + nupkg/common.ps1 | 1 + ...e.BookStore.BookManagement.Web.Host.csproj | 2 +- .../BookManagementWebHostModule.cs | 3 ++- ...ement.HttpApi.Client.ConsoleTestApp.csproj | 4 +++ ...Store.HttpApi.Client.ConsoleTestApp.csproj | 4 +++ ...yCompanyName.MyProjectName.Web.Host.csproj | 2 +- .../MyProjectNameWebModule.cs | 4 +-- ...tName.HttpApi.Client.ConsoleTestApp.csproj | 4 +++ 23 files changed, 104 insertions(+), 28 deletions(-) delete mode 100644 framework/src/Volo.Abp.Http.Client.IdentityModel.Relay/Volo/Abp/Http/Client/IdentityModel/Relay/AbpHttpClientIdentityModelModule.cs rename framework/src/{Volo.Abp.Http.Client.IdentityModel.Relay => Volo.Abp.Http.Client.IdentityModel.Web}/FodyWeavers.xml (100%) rename framework/src/{Volo.Abp.Http.Client.IdentityModel.Relay => Volo.Abp.Http.Client.IdentityModel.Web}/FodyWeavers.xsd (100%) rename framework/src/{Volo.Abp.Http.Client.IdentityModel.Relay => Volo.Abp.Http.Client.IdentityModel.Web}/Properties/launchSettings.json (100%) rename framework/src/{Volo.Abp.Http.Client.IdentityModel.Relay/Volo.Abp.Http.Client.IdentityModel.Relay.csproj => Volo.Abp.Http.Client.IdentityModel.Web/Volo.Abp.Http.Client.IdentityModel.Web.csproj} (85%) create mode 100644 framework/src/Volo.Abp.Http.Client.IdentityModel.Web/Volo/Abp/Http/Client/IdentityModel/Web/AbpHttpClientIdentityModelWebModule.cs rename framework/src/{Volo.Abp.Http.Client.IdentityModel.Relay/Volo/Abp/Http/Client/IdentityModel/Relay/IdentityModelRemoteServiceHttpClientRelayAuthenticator.cs => Volo.Abp.Http.Client.IdentityModel.Web/Volo/Abp/Http/Client/IdentityModel/Web/HttpContextIdentityModelRemoteServiceHttpClientAuthenticator.cs} (83%) create mode 100644 framework/test/Volo.Abp.Http.Client.IdentityModel.Web.Tests/Volo.Abp.Http.Client.IdentityModel.Web.Tests.csproj create mode 100644 framework/test/Volo.Abp.Http.Client.IdentityModel.Web.Tests/Volo/Abp/Http/Client/IdentityModel/Web/AbpHttpClientIdentityModelWebTestModule.cs create mode 100644 framework/test/Volo.Abp.Http.Client.IdentityModel.Web.Tests/Volo/Abp/Http/Client/IdentityModel/Web/HttpContextIdentityModelRemoteServiceHttpClientAuthenticator_Tests.cs diff --git a/framework/Volo.Abp.sln b/framework/Volo.Abp.sln index b2fb0c2336..88c8385b63 100644 --- a/framework/Volo.Abp.sln +++ b/framework/Volo.Abp.sln @@ -261,17 +261,19 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Volo.Abp.AspNetCore.Serilog EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Volo.Abp.AspNetCore.Serilog.Tests", "test\Volo.Abp.AspNetCore.Serilog.Tests\Volo.Abp.AspNetCore.Serilog.Tests.csproj", "{9CAA07ED-FE5C-4427-A6FA-6C6CB5B4CC62}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Volo.Abp.Http.Client.IdentityModel.Relay", "src\Volo.Abp.Http.Client.IdentityModel.Relay\Volo.Abp.Http.Client.IdentityModel.Relay.csproj", "{925AF101-2203-409C-9C3B-03917316858F}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Volo.Abp.Http.Client.IdentityModel.Web", "src\Volo.Abp.Http.Client.IdentityModel.Web\Volo.Abp.Http.Client.IdentityModel.Web.csproj", "{925AF101-2203-409C-9C3B-03917316858F}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Volo.Abp.BackgroundJobs.Quartz", "src\Volo.Abp.BackgroundJobs.Quartz\Volo.Abp.BackgroundJobs.Quartz.csproj", "{2307198B-5837-4F05-AA84-D6EC2A923D69}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Volo.Abp.Quartz", "src\Volo.Abp.Quartz\Volo.Abp.Quartz.csproj", "{9467418B-4A9B-4093-9B31-01A9DEF5B372}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Volo.Abp.BackgroundWorkers.Quartz", "src\Volo.Abp.BackgroundWorkers.Quartz\Volo.Abp.BackgroundWorkers.Quartz.csproj", "{CD5770BB-2E0C-4B3C-80E0-21B8CC43DBA9}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Volo.Abp.BackgroundWorkers.Quartz", "src\Volo.Abp.BackgroundWorkers.Quartz\Volo.Abp.BackgroundWorkers.Quartz.csproj", "{CD5770BB-2E0C-4B3C-80E0-21B8CC43DBA9}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo", "src\Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo\Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo.csproj", "{29E42ADB-85F8-44AE-A9B0-078F84C1B866}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo", "src\Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo\Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo.csproj", "{29E42ADB-85F8-44AE-A9B0-078F84C1B866}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo", "test\Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo\Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo.csproj", "{0C498CF2-D052-4BF7-AD35-509A90F69707}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo", "test\Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo\Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo.csproj", "{0C498CF2-D052-4BF7-AD35-509A90F69707}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Volo.Abp.Http.Client.IdentityModel.Web.Tests", "test\Volo.Abp.Http.Client.IdentityModel.Web.Tests\Volo.Abp.Http.Client.IdentityModel.Web.Tests.csproj", "{E1963439-2BE5-4DB5-8438-2A9A792A1ADA}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -811,6 +813,10 @@ Global {0C498CF2-D052-4BF7-AD35-509A90F69707}.Debug|Any CPU.Build.0 = Debug|Any CPU {0C498CF2-D052-4BF7-AD35-509A90F69707}.Release|Any CPU.ActiveCfg = Release|Any CPU {0C498CF2-D052-4BF7-AD35-509A90F69707}.Release|Any CPU.Build.0 = Release|Any CPU + {E1963439-2BE5-4DB5-8438-2A9A792A1ADA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E1963439-2BE5-4DB5-8438-2A9A792A1ADA}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E1963439-2BE5-4DB5-8438-2A9A792A1ADA}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E1963439-2BE5-4DB5-8438-2A9A792A1ADA}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -949,6 +955,7 @@ Global {CD5770BB-2E0C-4B3C-80E0-21B8CC43DBA9} = {5DF0E140-0513-4D0D-BE2E-3D4D85CD70E6} {29E42ADB-85F8-44AE-A9B0-078F84C1B866} = {5DF0E140-0513-4D0D-BE2E-3D4D85CD70E6} {0C498CF2-D052-4BF7-AD35-509A90F69707} = {447C8A77-E5F0-4538-8687-7383196D04EA} + {E1963439-2BE5-4DB5-8438-2A9A792A1ADA} = {447C8A77-E5F0-4538-8687-7383196D04EA} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {BB97ECF4-9A84-433F-A80B-2A3285BDD1D5} diff --git a/framework/src/Volo.Abp.Http.Client.IdentityModel.Relay/Volo/Abp/Http/Client/IdentityModel/Relay/AbpHttpClientIdentityModelModule.cs b/framework/src/Volo.Abp.Http.Client.IdentityModel.Relay/Volo/Abp/Http/Client/IdentityModel/Relay/AbpHttpClientIdentityModelModule.cs deleted file mode 100644 index 086d3de06d..0000000000 --- a/framework/src/Volo.Abp.Http.Client.IdentityModel.Relay/Volo/Abp/Http/Client/IdentityModel/Relay/AbpHttpClientIdentityModelModule.cs +++ /dev/null @@ -1,13 +0,0 @@ -using Volo.Abp.IdentityModel; -using Volo.Abp.Modularity; - -namespace Volo.Abp.Http.Client.IdentityModel.Relay -{ - [DependsOn( - typeof(AbpHttpClientIdentityModelModule) - )] - public class AbpHttpClientIdentityModelRelayModule : AbpModule - { - - } -} diff --git a/framework/src/Volo.Abp.Http.Client.IdentityModel.Relay/FodyWeavers.xml b/framework/src/Volo.Abp.Http.Client.IdentityModel.Web/FodyWeavers.xml similarity index 100% rename from framework/src/Volo.Abp.Http.Client.IdentityModel.Relay/FodyWeavers.xml rename to framework/src/Volo.Abp.Http.Client.IdentityModel.Web/FodyWeavers.xml diff --git a/framework/src/Volo.Abp.Http.Client.IdentityModel.Relay/FodyWeavers.xsd b/framework/src/Volo.Abp.Http.Client.IdentityModel.Web/FodyWeavers.xsd similarity index 100% rename from framework/src/Volo.Abp.Http.Client.IdentityModel.Relay/FodyWeavers.xsd rename to framework/src/Volo.Abp.Http.Client.IdentityModel.Web/FodyWeavers.xsd diff --git a/framework/src/Volo.Abp.Http.Client.IdentityModel.Relay/Properties/launchSettings.json b/framework/src/Volo.Abp.Http.Client.IdentityModel.Web/Properties/launchSettings.json similarity index 100% rename from framework/src/Volo.Abp.Http.Client.IdentityModel.Relay/Properties/launchSettings.json rename to framework/src/Volo.Abp.Http.Client.IdentityModel.Web/Properties/launchSettings.json diff --git a/framework/src/Volo.Abp.Http.Client.IdentityModel.Relay/Volo.Abp.Http.Client.IdentityModel.Relay.csproj b/framework/src/Volo.Abp.Http.Client.IdentityModel.Web/Volo.Abp.Http.Client.IdentityModel.Web.csproj similarity index 85% rename from framework/src/Volo.Abp.Http.Client.IdentityModel.Relay/Volo.Abp.Http.Client.IdentityModel.Relay.csproj rename to framework/src/Volo.Abp.Http.Client.IdentityModel.Web/Volo.Abp.Http.Client.IdentityModel.Web.csproj index 8974420c46..1518da9045 100644 --- a/framework/src/Volo.Abp.Http.Client.IdentityModel.Relay/Volo.Abp.Http.Client.IdentityModel.Relay.csproj +++ b/framework/src/Volo.Abp.Http.Client.IdentityModel.Web/Volo.Abp.Http.Client.IdentityModel.Web.csproj @@ -5,8 +5,8 @@ netcoreapp3.1 - Volo.Abp.Http.Client.IdentityModel.Relay - Volo.Abp.Http.Client.IdentityModel.Relay + Volo.Abp.Http.Client.IdentityModel.Web + Volo.Abp.Http.Client.IdentityModel.Web $(AssetTargetFallback);portable-net45+win8+wp8+wpa81; false false diff --git a/framework/src/Volo.Abp.Http.Client.IdentityModel.Web/Volo/Abp/Http/Client/IdentityModel/Web/AbpHttpClientIdentityModelWebModule.cs b/framework/src/Volo.Abp.Http.Client.IdentityModel.Web/Volo/Abp/Http/Client/IdentityModel/Web/AbpHttpClientIdentityModelWebModule.cs new file mode 100644 index 0000000000..bdb216e41c --- /dev/null +++ b/framework/src/Volo.Abp.Http.Client.IdentityModel.Web/Volo/Abp/Http/Client/IdentityModel/Web/AbpHttpClientIdentityModelWebModule.cs @@ -0,0 +1,12 @@ +using Volo.Abp.Modularity; + +namespace Volo.Abp.Http.Client.IdentityModel.Web +{ + [DependsOn( + typeof(AbpHttpClientIdentityModelModule) + )] + public class AbpHttpClientIdentityModelWebModule : AbpModule + { + + } +} diff --git a/framework/src/Volo.Abp.Http.Client.IdentityModel.Relay/Volo/Abp/Http/Client/IdentityModel/Relay/IdentityModelRemoteServiceHttpClientRelayAuthenticator.cs b/framework/src/Volo.Abp.Http.Client.IdentityModel.Web/Volo/Abp/Http/Client/IdentityModel/Web/HttpContextIdentityModelRemoteServiceHttpClientAuthenticator.cs similarity index 83% rename from framework/src/Volo.Abp.Http.Client.IdentityModel.Relay/Volo/Abp/Http/Client/IdentityModel/Relay/IdentityModelRemoteServiceHttpClientRelayAuthenticator.cs rename to framework/src/Volo.Abp.Http.Client.IdentityModel.Web/Volo/Abp/Http/Client/IdentityModel/Web/HttpContextIdentityModelRemoteServiceHttpClientAuthenticator.cs index 25a1fc771c..a829a630d6 100644 --- a/framework/src/Volo.Abp.Http.Client.IdentityModel.Relay/Volo/Abp/Http/Client/IdentityModel/Relay/IdentityModelRemoteServiceHttpClientRelayAuthenticator.cs +++ b/framework/src/Volo.Abp.Http.Client.IdentityModel.Web/Volo/Abp/Http/Client/IdentityModel/Web/HttpContextIdentityModelRemoteServiceHttpClientAuthenticator.cs @@ -6,14 +6,14 @@ using Volo.Abp.DependencyInjection; using Volo.Abp.Http.Client.Authentication; using Volo.Abp.IdentityModel; -namespace Volo.Abp.Http.Client.IdentityModel.Relay +namespace Volo.Abp.Http.Client.IdentityModel.Web { [Dependency(ReplaceServices = true)] - public class IdentityModelRemoteServiceHttpClientRelayAuthenticator : IdentityModelRemoteServiceHttpClientAuthenticator, ITransientDependency + public class HttpContextIdentityModelRemoteServiceHttpClientAuthenticator : IdentityModelRemoteServiceHttpClientAuthenticator { public IHttpContextAccessor HttpContextAccessor { get; set; } - public IdentityModelRemoteServiceHttpClientRelayAuthenticator( + public HttpContextIdentityModelRemoteServiceHttpClientAuthenticator( IIdentityModelAuthenticationService identityModelAuthenticationService) : base(identityModelAuthenticationService) { diff --git a/framework/src/Volo.Abp.Http.Client.IdentityModel/Volo/Abp/Http/Client/IdentityModel/IdentityModelRemoteServiceHttpClientAuthenticator.cs b/framework/src/Volo.Abp.Http.Client.IdentityModel/Volo/Abp/Http/Client/IdentityModel/IdentityModelRemoteServiceHttpClientAuthenticator.cs index 5d9a85e0c5..0b1749f445 100644 --- a/framework/src/Volo.Abp.Http.Client.IdentityModel/Volo/Abp/Http/Client/IdentityModel/IdentityModelRemoteServiceHttpClientAuthenticator.cs +++ b/framework/src/Volo.Abp.Http.Client.IdentityModel/Volo/Abp/Http/Client/IdentityModel/IdentityModelRemoteServiceHttpClientAuthenticator.cs @@ -1,5 +1,4 @@ using System.Threading.Tasks; -using IdentityModel.Client; using Volo.Abp.DependencyInjection; using Volo.Abp.Http.Client.Authentication; using Volo.Abp.IdentityModel; diff --git a/framework/src/Volo.Abp.IdentityModel/Volo/Abp/IdentityModel/AbpIdentityModelModule.cs b/framework/src/Volo.Abp.IdentityModel/Volo/Abp/IdentityModel/AbpIdentityModelModule.cs index b26b545fec..d0a08707b5 100644 --- a/framework/src/Volo.Abp.IdentityModel/Volo/Abp/IdentityModel/AbpIdentityModelModule.cs +++ b/framework/src/Volo.Abp.IdentityModel/Volo/Abp/IdentityModel/AbpIdentityModelModule.cs @@ -13,6 +13,8 @@ namespace Volo.Abp.IdentityModel { var configuration = context.Services.GetConfiguration(); + context.Services.AddHttpClient(); + Configure(configuration); } } diff --git a/framework/test/Volo.Abp.Http.Client.IdentityModel.Web.Tests/Volo.Abp.Http.Client.IdentityModel.Web.Tests.csproj b/framework/test/Volo.Abp.Http.Client.IdentityModel.Web.Tests/Volo.Abp.Http.Client.IdentityModel.Web.Tests.csproj new file mode 100644 index 0000000000..704c3b57aa --- /dev/null +++ b/framework/test/Volo.Abp.Http.Client.IdentityModel.Web.Tests/Volo.Abp.Http.Client.IdentityModel.Web.Tests.csproj @@ -0,0 +1,16 @@ + + + + + + netcoreapp3.1 + + + + + + + + + + diff --git a/framework/test/Volo.Abp.Http.Client.IdentityModel.Web.Tests/Volo/Abp/Http/Client/IdentityModel/Web/AbpHttpClientIdentityModelWebTestModule.cs b/framework/test/Volo.Abp.Http.Client.IdentityModel.Web.Tests/Volo/Abp/Http/Client/IdentityModel/Web/AbpHttpClientIdentityModelWebTestModule.cs new file mode 100644 index 0000000000..afd46d8d1c --- /dev/null +++ b/framework/test/Volo.Abp.Http.Client.IdentityModel.Web.Tests/Volo/Abp/Http/Client/IdentityModel/Web/AbpHttpClientIdentityModelWebTestModule.cs @@ -0,0 +1,10 @@ +using Volo.Abp.Modularity; + +namespace Volo.Abp.Http.Client.IdentityModel.Web.Tests +{ + [DependsOn(typeof(AbpHttpClientIdentityModelWebModule))] + public class AbpHttpClientIdentityModelWebTestModule : AbpModule + { + + } +} diff --git a/framework/test/Volo.Abp.Http.Client.IdentityModel.Web.Tests/Volo/Abp/Http/Client/IdentityModel/Web/HttpContextIdentityModelRemoteServiceHttpClientAuthenticator_Tests.cs b/framework/test/Volo.Abp.Http.Client.IdentityModel.Web.Tests/Volo/Abp/Http/Client/IdentityModel/Web/HttpContextIdentityModelRemoteServiceHttpClientAuthenticator_Tests.cs new file mode 100644 index 0000000000..63da9ae62a --- /dev/null +++ b/framework/test/Volo.Abp.Http.Client.IdentityModel.Web.Tests/Volo/Abp/Http/Client/IdentityModel/Web/HttpContextIdentityModelRemoteServiceHttpClientAuthenticator_Tests.cs @@ -0,0 +1,26 @@ +using Shouldly; +using Volo.Abp.DynamicProxy; +using Volo.Abp.Http.Client.Authentication; +using Volo.Abp.Http.Client.IdentityModel.Web.Tests; +using Volo.Abp.Testing; +using Xunit; + +namespace Volo.Abp.Http.Client.IdentityModel.Web +{ + public class HttpContextIdentityModelRemoteServiceHttpClientAuthenticator_Tests : AbpIntegratedTest + { + private readonly IRemoteServiceHttpClientAuthenticator _remoteServiceHttpClientAuthenticator; + + public HttpContextIdentityModelRemoteServiceHttpClientAuthenticator_Tests() + { + _remoteServiceHttpClientAuthenticator = GetRequiredService(); + } + + [Fact] + public void Implementation_Should_Be_Type_Of_HttpContextIdentityModelRemoteServiceHttpClientAuthenticator() + { + ProxyHelper.UnProxy(_remoteServiceHttpClientAuthenticator) + .ShouldBeOfType(typeof(HttpContextIdentityModelRemoteServiceHttpClientAuthenticator)); + } + } +} diff --git a/modules/client-simulation/src/Volo.ClientSimulation.Web/ClientSimulationWebModule.cs b/modules/client-simulation/src/Volo.ClientSimulation.Web/ClientSimulationWebModule.cs index c75ee14656..8cdc7809ab 100644 --- a/modules/client-simulation/src/Volo.ClientSimulation.Web/ClientSimulationWebModule.cs +++ b/modules/client-simulation/src/Volo.ClientSimulation.Web/ClientSimulationWebModule.cs @@ -1,4 +1,5 @@ using Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared; +using Volo.Abp.Http.Client.IdentityModel.Web; using Volo.Abp.Modularity; using Volo.Abp.VirtualFileSystem; @@ -6,6 +7,7 @@ namespace Volo.ClientSimulation { [DependsOn( typeof(ClientSimulationModule), + typeof(AbpHttpClientIdentityModelWebModule), typeof(AbpAspNetCoreMvcUiThemeSharedModule) )] public class ClientSimulationWebModule : AbpModule diff --git a/modules/client-simulation/src/Volo.ClientSimulation.Web/Volo.ClientSimulation.Web.csproj b/modules/client-simulation/src/Volo.ClientSimulation.Web/Volo.ClientSimulation.Web.csproj index ad0ce496f5..57b87b9e72 100644 --- a/modules/client-simulation/src/Volo.ClientSimulation.Web/Volo.ClientSimulation.Web.csproj +++ b/modules/client-simulation/src/Volo.ClientSimulation.Web/Volo.ClientSimulation.Web.csproj @@ -15,6 +15,7 @@ + diff --git a/nupkg/common.ps1 b/nupkg/common.ps1 index 812f822108..52c2a54464 100644 --- a/nupkg/common.ps1 +++ b/nupkg/common.ps1 @@ -81,6 +81,7 @@ $projects = ( "framework/src/Volo.Abp.Http.Client.IdentityModel", "framework/src/Volo.Abp.Http", "framework/src/Volo.Abp.IdentityModel", + "framework/src/Volo.Abp.IdentityModel.Web", "framework/src/Volo.Abp.Json", "framework/src/Volo.Abp.Ldap", "framework/src/Volo.Abp.Localization.Abstractions", diff --git a/samples/BookStore-Modular/modules/book-management/host/Acme.BookStore.BookManagement.Web.Host/Acme.BookStore.BookManagement.Web.Host.csproj b/samples/BookStore-Modular/modules/book-management/host/Acme.BookStore.BookManagement.Web.Host/Acme.BookStore.BookManagement.Web.Host.csproj index 34f8bcf4c1..d2022bb48f 100644 --- a/samples/BookStore-Modular/modules/book-management/host/Acme.BookStore.BookManagement.Web.Host/Acme.BookStore.BookManagement.Web.Host.csproj +++ b/samples/BookStore-Modular/modules/book-management/host/Acme.BookStore.BookManagement.Web.Host/Acme.BookStore.BookManagement.Web.Host.csproj @@ -19,7 +19,7 @@ - + diff --git a/samples/BookStore-Modular/modules/book-management/host/Acme.BookStore.BookManagement.Web.Host/BookManagementWebHostModule.cs b/samples/BookStore-Modular/modules/book-management/host/Acme.BookStore.BookManagement.Web.Host/BookManagementWebHostModule.cs index da1a8dc2fb..9e7c7db897 100644 --- a/samples/BookStore-Modular/modules/book-management/host/Acme.BookStore.BookManagement.Web.Host/BookManagementWebHostModule.cs +++ b/samples/BookStore-Modular/modules/book-management/host/Acme.BookStore.BookManagement.Web.Host/BookManagementWebHostModule.cs @@ -26,6 +26,7 @@ using Volo.Abp.Autofac; using Volo.Abp.AutoMapper; using Volo.Abp.Caching; using Volo.Abp.Http.Client.IdentityModel; +using Volo.Abp.Http.Client.IdentityModel.Web; using Volo.Abp.Identity; using Volo.Abp.Identity.Web; using Volo.Abp.Modularity; @@ -48,7 +49,7 @@ namespace Acme.BookStore.BookManagement typeof(AbpAspNetCoreMvcClientModule), typeof(AbpAspNetCoreMvcUiBasicThemeModule), typeof(AbpAutofacModule), - typeof(AbpHttpClientIdentityModelModule), + typeof(AbpHttpClientIdentityModelWebModule), typeof(AbpIdentityWebModule), typeof(AbpIdentityHttpApiClientModule), typeof(AbpTenantManagementWebModule), diff --git a/samples/BookStore-Modular/modules/book-management/test/Acme.BookStore.BookManagement.HttpApi.Client.ConsoleTestApp/Acme.BookStore.BookManagement.HttpApi.Client.ConsoleTestApp.csproj b/samples/BookStore-Modular/modules/book-management/test/Acme.BookStore.BookManagement.HttpApi.Client.ConsoleTestApp/Acme.BookStore.BookManagement.HttpApi.Client.ConsoleTestApp.csproj index 463c12d939..9e02f60d52 100644 --- a/samples/BookStore-Modular/modules/book-management/test/Acme.BookStore.BookManagement.HttpApi.Client.ConsoleTestApp/Acme.BookStore.BookManagement.HttpApi.Client.ConsoleTestApp.csproj +++ b/samples/BookStore-Modular/modules/book-management/test/Acme.BookStore.BookManagement.HttpApi.Client.ConsoleTestApp/Acme.BookStore.BookManagement.HttpApi.Client.ConsoleTestApp.csproj @@ -19,4 +19,8 @@ + + + +
    diff --git a/samples/BookStore/test/Acme.BookStore.HttpApi.Client.ConsoleTestApp/Acme.BookStore.HttpApi.Client.ConsoleTestApp.csproj b/samples/BookStore/test/Acme.BookStore.HttpApi.Client.ConsoleTestApp/Acme.BookStore.HttpApi.Client.ConsoleTestApp.csproj index c4387a063f..dcc021eee6 100644 --- a/samples/BookStore/test/Acme.BookStore.HttpApi.Client.ConsoleTestApp/Acme.BookStore.HttpApi.Client.ConsoleTestApp.csproj +++ b/samples/BookStore/test/Acme.BookStore.HttpApi.Client.ConsoleTestApp/Acme.BookStore.HttpApi.Client.ConsoleTestApp.csproj @@ -21,4 +21,8 @@ + + + +
    diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web.Host/MyCompanyName.MyProjectName.Web.Host.csproj b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web.Host/MyCompanyName.MyProjectName.Web.Host.csproj index 697cbe1b44..ae37bbd5a1 100644 --- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web.Host/MyCompanyName.MyProjectName.Web.Host.csproj +++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web.Host/MyCompanyName.MyProjectName.Web.Host.csproj @@ -31,7 +31,7 @@ - + diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web.Host/MyProjectNameWebModule.cs b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web.Host/MyProjectNameWebModule.cs index d2b050644f..102ff5eee9 100644 --- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web.Host/MyProjectNameWebModule.cs +++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web.Host/MyProjectNameWebModule.cs @@ -27,7 +27,7 @@ using Volo.Abp.Autofac; using Volo.Abp.AutoMapper; using Volo.Abp.Caching; using Volo.Abp.FeatureManagement; -using Volo.Abp.Http.Client.IdentityModel; +using Volo.Abp.Http.Client.IdentityModel.Web; using Volo.Abp.Identity.Web; using Volo.Abp.Modularity; using Volo.Abp.MultiTenancy; @@ -48,7 +48,7 @@ namespace MyCompanyName.MyProjectName.Web typeof(AbpAspNetCoreMvcUiBasicThemeModule), typeof(AbpAutofacModule), typeof(AbpFeatureManagementWebModule), - typeof(AbpHttpClientIdentityModelModule), + typeof(AbpHttpClientIdentityModelWebModule), typeof(AbpIdentityWebModule), typeof(AbpTenantManagementWebModule), typeof(AbpAspNetCoreSerilogModule) diff --git a/templates/app/aspnet-core/test/MyCompanyName.MyProjectName.HttpApi.Client.ConsoleTestApp/MyCompanyName.MyProjectName.HttpApi.Client.ConsoleTestApp.csproj b/templates/app/aspnet-core/test/MyCompanyName.MyProjectName.HttpApi.Client.ConsoleTestApp/MyCompanyName.MyProjectName.HttpApi.Client.ConsoleTestApp.csproj index a70855393d..571b6a2d30 100644 --- a/templates/app/aspnet-core/test/MyCompanyName.MyProjectName.HttpApi.Client.ConsoleTestApp/MyCompanyName.MyProjectName.HttpApi.Client.ConsoleTestApp.csproj +++ b/templates/app/aspnet-core/test/MyCompanyName.MyProjectName.HttpApi.Client.ConsoleTestApp/MyCompanyName.MyProjectName.HttpApi.Client.ConsoleTestApp.csproj @@ -20,5 +20,9 @@ + + + +
    From e46632e98fff780883483b0343d5faa8b274b64e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?= Date: Tue, 3 Mar 2020 11:39:33 +0300 Subject: [PATCH 52/56] Add Microsoft.Extensions.Hosting to the console apps. --- .../Acme.BookStore.HttpApi.Client.ConsoleTestApp.csproj | 4 ++++ .../Acme.BookStore.HttpApi.Client.ConsoleTestApp.csproj | 4 ++++ .../DashboardDemo.HttpApi.Client.ConsoleTestApp.csproj | 4 ++++ 3 files changed, 12 insertions(+) diff --git a/samples/BookStore-Angular-MongoDb/aspnet-core/test/Acme.BookStore.HttpApi.Client.ConsoleTestApp/Acme.BookStore.HttpApi.Client.ConsoleTestApp.csproj b/samples/BookStore-Angular-MongoDb/aspnet-core/test/Acme.BookStore.HttpApi.Client.ConsoleTestApp/Acme.BookStore.HttpApi.Client.ConsoleTestApp.csproj index af90ca7a55..7c32b6f914 100644 --- a/samples/BookStore-Angular-MongoDb/aspnet-core/test/Acme.BookStore.HttpApi.Client.ConsoleTestApp/Acme.BookStore.HttpApi.Client.ConsoleTestApp.csproj +++ b/samples/BookStore-Angular-MongoDb/aspnet-core/test/Acme.BookStore.HttpApi.Client.ConsoleTestApp/Acme.BookStore.HttpApi.Client.ConsoleTestApp.csproj @@ -20,5 +20,9 @@ + + + +
    diff --git a/samples/BookStore-Modular/application/test/Acme.BookStore.HttpApi.Client.ConsoleTestApp/Acme.BookStore.HttpApi.Client.ConsoleTestApp.csproj b/samples/BookStore-Modular/application/test/Acme.BookStore.HttpApi.Client.ConsoleTestApp/Acme.BookStore.HttpApi.Client.ConsoleTestApp.csproj index af90ca7a55..7c32b6f914 100644 --- a/samples/BookStore-Modular/application/test/Acme.BookStore.HttpApi.Client.ConsoleTestApp/Acme.BookStore.HttpApi.Client.ConsoleTestApp.csproj +++ b/samples/BookStore-Modular/application/test/Acme.BookStore.HttpApi.Client.ConsoleTestApp/Acme.BookStore.HttpApi.Client.ConsoleTestApp.csproj @@ -20,5 +20,9 @@ + + + +
    diff --git a/samples/DashboardDemo/test/DashboardDemo.HttpApi.Client.ConsoleTestApp/DashboardDemo.HttpApi.Client.ConsoleTestApp.csproj b/samples/DashboardDemo/test/DashboardDemo.HttpApi.Client.ConsoleTestApp/DashboardDemo.HttpApi.Client.ConsoleTestApp.csproj index ea3b5f2a53..3587fdc2b8 100644 --- a/samples/DashboardDemo/test/DashboardDemo.HttpApi.Client.ConsoleTestApp/DashboardDemo.HttpApi.Client.ConsoleTestApp.csproj +++ b/samples/DashboardDemo/test/DashboardDemo.HttpApi.Client.ConsoleTestApp/DashboardDemo.HttpApi.Client.ConsoleTestApp.csproj @@ -17,5 +17,9 @@ + + + +
    From e0c821a89289f277371230c4407b4c6978d21010 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?= Date: Tue, 3 Mar 2020 11:39:55 +0300 Subject: [PATCH 53/56] Update Acme.BookStore.HttpApi.Client.ConsoleTestApp.csproj --- .../Acme.BookStore.HttpApi.Client.ConsoleTestApp.csproj | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/samples/EfCoreMigrationDemo/test/Acme.BookStore.HttpApi.Client.ConsoleTestApp/Acme.BookStore.HttpApi.Client.ConsoleTestApp.csproj b/samples/EfCoreMigrationDemo/test/Acme.BookStore.HttpApi.Client.ConsoleTestApp/Acme.BookStore.HttpApi.Client.ConsoleTestApp.csproj index 561ad3012d..d96dcacc8b 100644 --- a/samples/EfCoreMigrationDemo/test/Acme.BookStore.HttpApi.Client.ConsoleTestApp/Acme.BookStore.HttpApi.Client.ConsoleTestApp.csproj +++ b/samples/EfCoreMigrationDemo/test/Acme.BookStore.HttpApi.Client.ConsoleTestApp/Acme.BookStore.HttpApi.Client.ConsoleTestApp.csproj @@ -20,5 +20,9 @@ + + + + From f70c2280f701f9dd906e3224eb807982114302ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?= Date: Tue, 3 Mar 2020 11:40:36 +0300 Subject: [PATCH 54/56] Apply #2960 for the microservice demo solution. --- .../BackendAdminApp.Host/BackendAdminApp.Host.csproj | 2 +- .../BackendAdminApp.Host/BackendAdminAppHostModule.cs | 4 ++-- .../applications/ConsoleClientDemo/ConsoleClientDemo.csproj | 4 ++++ .../applications/PublicWebSite.Host/PublicWebSite.Host.csproj | 2 +- .../PublicWebSite.Host/PublicWebSiteHostModule.cs | 4 ++-- .../BackendAdminAppGateway.Host.csproj | 2 +- .../BackendAdminAppGatewayHostModule.cs | 4 ++-- .../BloggingService.Host/BloggingService.Host.csproj | 2 +- .../BloggingService.Host/BloggingServiceHostModule.cs | 4 ++-- 9 files changed, 16 insertions(+), 12 deletions(-) diff --git a/samples/MicroserviceDemo/applications/BackendAdminApp.Host/BackendAdminApp.Host.csproj b/samples/MicroserviceDemo/applications/BackendAdminApp.Host/BackendAdminApp.Host.csproj index bc29c3d237..cc23b9f584 100644 --- a/samples/MicroserviceDemo/applications/BackendAdminApp.Host/BackendAdminApp.Host.csproj +++ b/samples/MicroserviceDemo/applications/BackendAdminApp.Host/BackendAdminApp.Host.csproj @@ -25,7 +25,7 @@ - + diff --git a/samples/MicroserviceDemo/applications/BackendAdminApp.Host/BackendAdminAppHostModule.cs b/samples/MicroserviceDemo/applications/BackendAdminApp.Host/BackendAdminAppHostModule.cs index d04fc1e656..395b40aeb0 100644 --- a/samples/MicroserviceDemo/applications/BackendAdminApp.Host/BackendAdminAppHostModule.cs +++ b/samples/MicroserviceDemo/applications/BackendAdminApp.Host/BackendAdminAppHostModule.cs @@ -13,7 +13,7 @@ using Volo.Abp.AspNetCore.Authentication.OAuth; using Volo.Abp.AspNetCore.Mvc.Client; using Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic; using Volo.Abp.Autofac; -using Volo.Abp.Http.Client.IdentityModel; +using Volo.Abp.Http.Client.IdentityModel.Web; using Volo.Abp.Identity; using Volo.Abp.Identity.Web; using Volo.Abp.Localization; @@ -27,7 +27,7 @@ namespace BackendAdminApp.Host typeof(AbpAutofacModule), typeof(AbpAspNetCoreMvcClientModule), typeof(AbpAspNetCoreAuthenticationOAuthModule), - typeof(AbpHttpClientIdentityModelModule), + typeof(AbpHttpClientIdentityModelWebModule), typeof(AbpIdentityHttpApiClientModule), typeof(AbpIdentityWebModule), typeof(BloggingApplicationContractsModule), diff --git a/samples/MicroserviceDemo/applications/ConsoleClientDemo/ConsoleClientDemo.csproj b/samples/MicroserviceDemo/applications/ConsoleClientDemo/ConsoleClientDemo.csproj index 7ee4c756aa..2443f75e5d 100644 --- a/samples/MicroserviceDemo/applications/ConsoleClientDemo/ConsoleClientDemo.csproj +++ b/samples/MicroserviceDemo/applications/ConsoleClientDemo/ConsoleClientDemo.csproj @@ -16,6 +16,10 @@ + + + + diff --git a/samples/MicroserviceDemo/applications/PublicWebSite.Host/PublicWebSite.Host.csproj b/samples/MicroserviceDemo/applications/PublicWebSite.Host/PublicWebSite.Host.csproj index 2370ae2a7a..24b6082352 100644 --- a/samples/MicroserviceDemo/applications/PublicWebSite.Host/PublicWebSite.Host.csproj +++ b/samples/MicroserviceDemo/applications/PublicWebSite.Host/PublicWebSite.Host.csproj @@ -24,7 +24,7 @@ - + diff --git a/samples/MicroserviceDemo/applications/PublicWebSite.Host/PublicWebSiteHostModule.cs b/samples/MicroserviceDemo/applications/PublicWebSite.Host/PublicWebSiteHostModule.cs index 66ea6d174c..4948995e35 100644 --- a/samples/MicroserviceDemo/applications/PublicWebSite.Host/PublicWebSiteHostModule.cs +++ b/samples/MicroserviceDemo/applications/PublicWebSite.Host/PublicWebSiteHostModule.cs @@ -11,7 +11,7 @@ using Volo.Abp.AspNetCore.Authentication.OAuth; using Volo.Abp.AspNetCore.Mvc.Client; using Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic; using Volo.Abp.Autofac; -using Volo.Abp.Http.Client.IdentityModel; +using Volo.Abp.Http.Client.IdentityModel.Web; using Volo.Abp.Localization; using Volo.Abp.Modularity; using Volo.Abp.UI.Navigation; @@ -23,7 +23,7 @@ namespace PublicWebSite.Host typeof(AbpAutofacModule), typeof(AbpAspNetCoreMvcClientModule), typeof(AbpAspNetCoreAuthenticationOAuthModule), - typeof(AbpHttpClientIdentityModelModule), + typeof(AbpHttpClientIdentityModelWebModule), typeof(AbpAspNetCoreMvcUiBasicThemeModule), typeof(BloggingHttpApiClientModule), typeof(BloggingWebModule), diff --git a/samples/MicroserviceDemo/gateways/BackendAdminAppGateway.Host/BackendAdminAppGateway.Host.csproj b/samples/MicroserviceDemo/gateways/BackendAdminAppGateway.Host/BackendAdminAppGateway.Host.csproj index 89c3bdb5be..4e2bbba6a6 100644 --- a/samples/MicroserviceDemo/gateways/BackendAdminAppGateway.Host/BackendAdminAppGateway.Host.csproj +++ b/samples/MicroserviceDemo/gateways/BackendAdminAppGateway.Host/BackendAdminAppGateway.Host.csproj @@ -25,7 +25,7 @@ - + diff --git a/samples/MicroserviceDemo/gateways/BackendAdminAppGateway.Host/BackendAdminAppGatewayHostModule.cs b/samples/MicroserviceDemo/gateways/BackendAdminAppGateway.Host/BackendAdminAppGatewayHostModule.cs index 81a109a6f0..7004215dcf 100644 --- a/samples/MicroserviceDemo/gateways/BackendAdminAppGateway.Host/BackendAdminAppGatewayHostModule.cs +++ b/samples/MicroserviceDemo/gateways/BackendAdminAppGateway.Host/BackendAdminAppGatewayHostModule.cs @@ -14,7 +14,7 @@ using Volo.Abp; using Volo.Abp.Autofac; using Volo.Abp.EntityFrameworkCore; using Volo.Abp.EntityFrameworkCore.SqlServer; -using Volo.Abp.Http.Client.IdentityModel; +using Volo.Abp.Http.Client.IdentityModel.Web; using Volo.Abp.Identity; using Volo.Abp.Modularity; using Volo.Abp.PermissionManagement; @@ -41,7 +41,7 @@ namespace BackendAdminAppGateway.Host typeof(BloggingApplicationContractsModule), typeof(AbpPermissionManagementDomainIdentityModule), typeof(AbpPermissionManagementDomainIdentityServerModule), - typeof(AbpHttpClientIdentityModelModule) + typeof(AbpHttpClientIdentityModelWebModule) )] public class BackendAdminAppGatewayHostModule : AbpModule { diff --git a/samples/MicroserviceDemo/microservices/BloggingService.Host/BloggingService.Host.csproj b/samples/MicroserviceDemo/microservices/BloggingService.Host/BloggingService.Host.csproj index 5bb58b92ec..024d64a5e4 100644 --- a/samples/MicroserviceDemo/microservices/BloggingService.Host/BloggingService.Host.csproj +++ b/samples/MicroserviceDemo/microservices/BloggingService.Host/BloggingService.Host.csproj @@ -25,7 +25,7 @@ - + diff --git a/samples/MicroserviceDemo/microservices/BloggingService.Host/BloggingServiceHostModule.cs b/samples/MicroserviceDemo/microservices/BloggingService.Host/BloggingServiceHostModule.cs index 2d7e945cf5..b72a4f56a6 100644 --- a/samples/MicroserviceDemo/microservices/BloggingService.Host/BloggingServiceHostModule.cs +++ b/samples/MicroserviceDemo/microservices/BloggingService.Host/BloggingServiceHostModule.cs @@ -19,7 +19,7 @@ using Volo.Abp.EntityFrameworkCore; using Volo.Abp.EntityFrameworkCore.SqlServer; using Volo.Abp.EventBus.RabbitMq; using Volo.Abp.Guids; -using Volo.Abp.Http.Client.IdentityModel; +using Volo.Abp.Http.Client.IdentityModel.Web; using Volo.Abp.Identity; using Volo.Abp.Localization; using Volo.Abp.Modularity; @@ -44,7 +44,7 @@ namespace BloggingService.Host typeof(BloggingHttpApiModule), typeof(BloggingMongoDbModule), typeof(BloggingApplicationModule), - typeof(AbpHttpClientIdentityModelModule), + typeof(AbpHttpClientIdentityModelWebModule), typeof(AbpIdentityHttpApiClientModule) )] public class BloggingServiceHostModule : AbpModule From 7d94050caec05bdb3b2095d3d26a0869d9104c2e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?= Date: Tue, 3 Mar 2020 11:41:53 +0300 Subject: [PATCH 55/56] Apply #2960 for the module template --- .../MyCompanyName.MyProjectName.Web.Host.csproj | 2 +- .../MyProjectNameWebHostModule.cs | 4 ++-- ...anyName.MyProjectName.HttpApi.Client.ConsoleTestApp.csproj | 4 ++++ 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Host/MyCompanyName.MyProjectName.Web.Host.csproj b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Host/MyCompanyName.MyProjectName.Web.Host.csproj index 338f55bc5f..d3e5f19e78 100644 --- a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Host/MyCompanyName.MyProjectName.Web.Host.csproj +++ b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Host/MyCompanyName.MyProjectName.Web.Host.csproj @@ -20,7 +20,7 @@ - + diff --git a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Host/MyProjectNameWebHostModule.cs b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Host/MyProjectNameWebHostModule.cs index 41fb8fc7f2..41b48d4548 100644 --- a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Host/MyProjectNameWebHostModule.cs +++ b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Host/MyProjectNameWebHostModule.cs @@ -26,7 +26,7 @@ using Volo.Abp.Autofac; using Volo.Abp.AutoMapper; using Volo.Abp.Caching; using Volo.Abp.FeatureManagement; -using Volo.Abp.Http.Client.IdentityModel; +using Volo.Abp.Http.Client.IdentityModel.Web; using Volo.Abp.Identity; using Volo.Abp.Identity.Web; using Volo.Abp.Modularity; @@ -50,7 +50,7 @@ namespace MyCompanyName.MyProjectName typeof(AbpAspNetCoreMvcClientModule), typeof(AbpAspNetCoreMvcUiBasicThemeModule), typeof(AbpAutofacModule), - typeof(AbpHttpClientIdentityModelModule), + typeof(AbpHttpClientIdentityModelWebModule), typeof(AbpIdentityWebModule), typeof(AbpIdentityHttpApiClientModule), typeof(AbpTenantManagementWebModule), diff --git a/templates/module/aspnet-core/test/MyCompanyName.MyProjectName.HttpApi.Client.ConsoleTestApp/MyCompanyName.MyProjectName.HttpApi.Client.ConsoleTestApp.csproj b/templates/module/aspnet-core/test/MyCompanyName.MyProjectName.HttpApi.Client.ConsoleTestApp/MyCompanyName.MyProjectName.HttpApi.Client.ConsoleTestApp.csproj index 35f7e7344c..59de0da1ef 100644 --- a/templates/module/aspnet-core/test/MyCompanyName.MyProjectName.HttpApi.Client.ConsoleTestApp/MyCompanyName.MyProjectName.HttpApi.Client.ConsoleTestApp.csproj +++ b/templates/module/aspnet-core/test/MyCompanyName.MyProjectName.HttpApi.Client.ConsoleTestApp/MyCompanyName.MyProjectName.HttpApi.Client.ConsoleTestApp.csproj @@ -19,4 +19,8 @@ + + + + From e9735e9a65670c67d7a740cd3f9a57b264c53b0b Mon Sep 17 00:00:00 2001 From: Yunus Emre Kalkan Date: Tue, 3 Mar 2020 13:53:20 +0300 Subject: [PATCH 56/56] fix: missing await in AbpDynamicformTagHelperService --- .../TagHelpers/Form/AbpDynamicformTagHelperService.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Form/AbpDynamicformTagHelperService.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Form/AbpDynamicformTagHelperService.cs index ee2a920980..6f8ccf285a 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Form/AbpDynamicformTagHelperService.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Form/AbpDynamicformTagHelperService.cs @@ -47,7 +47,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Form SetFormAttributes(context, output); - SetSubmitButton(context, output); + await SetSubmitButton(context, output); } protected virtual async Task ConvertToMvcForm(TagHelperContext context, TagHelperOutput output) @@ -107,14 +107,14 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Form output.Content.SetHtmlContent(childContent); } - protected virtual void SetSubmitButton(TagHelperContext context, TagHelperOutput output) + protected virtual async Task SetSubmitButton(TagHelperContext context, TagHelperOutput output) { if (!TagHelper.SubmitButton ?? true) { return; } - var buttonHtml = ProcessSubmitButtonAndGetContentAsync(context, output); + var buttonHtml = await ProcessSubmitButtonAndGetContentAsync(context, output); output.PostContent.SetHtmlContent(output.PostContent.GetContent() + buttonHtml); }