From a24eceabee49f878f6ef39b46895f5b8fc8e8b7c Mon Sep 17 00:00:00 2001 From: maliming Date: Wed, 13 Mar 2024 15:16:29 +0800 Subject: [PATCH] Add `Volo.Abp.AspNetCore.Abstractions` package. --- framework/Volo.Abp.sln | 7 +++++ .../FodyWeavers.xml | 3 ++ .../FodyWeavers.xsd | 30 +++++++++++++++++++ .../Volo.Abp.AspNetCore.Abstractions.csproj | 23 ++++++++++++++ .../AbpAspNetCoreAbstractionsModule.cs | 15 ++++++++++ .../Volo/Abp/AspNetCore/Filters/IAbpFilter.cs | 0 .../IWebContentFileProvider.cs | 0 .../NullWebContentFileProvider.cs | 22 ++++++++++++++ .../WebClientInfo/IWebClientInfoProvider.cs | 0 .../NullWebClientInfoProvider.cs | 10 +++++++ .../Volo.Abp.AspNetCore.csproj | 1 + .../Abp/AspNetCore/AbpAspNetCoreModule.cs | 3 +- .../WebContentFileProvider.cs | 1 + .../HttpContextWebClientInfoProvider.cs | 1 + nupkg/common.ps1 | 1 + 15 files changed, 116 insertions(+), 1 deletion(-) create mode 100644 framework/src/Volo.Abp.AspNetCore.Abstractions/FodyWeavers.xml create mode 100644 framework/src/Volo.Abp.AspNetCore.Abstractions/FodyWeavers.xsd create mode 100644 framework/src/Volo.Abp.AspNetCore.Abstractions/Volo.Abp.AspNetCore.Abstractions.csproj create mode 100644 framework/src/Volo.Abp.AspNetCore.Abstractions/Volo/Abp/AspNetCore/AbpAspNetCoreAbstractionsModule.cs rename framework/src/{Volo.Abp.AspNetCore => Volo.Abp.AspNetCore.Abstractions}/Volo/Abp/AspNetCore/Filters/IAbpFilter.cs (100%) rename framework/src/{Volo.Abp.AspNetCore => Volo.Abp.AspNetCore.Abstractions}/Volo/Abp/AspNetCore/VirtualFileSystem/IWebContentFileProvider.cs (100%) create mode 100644 framework/src/Volo.Abp.AspNetCore.Abstractions/Volo/Abp/AspNetCore/VirtualFileSystem/NullWebContentFileProvider.cs rename framework/src/{Volo.Abp.AspNetCore => Volo.Abp.AspNetCore.Abstractions}/Volo/Abp/AspNetCore/WebClientInfo/IWebClientInfoProvider.cs (100%) create mode 100644 framework/src/Volo.Abp.AspNetCore.Abstractions/Volo/Abp/AspNetCore/WebClientInfo/NullWebClientInfoProvider.cs diff --git a/framework/Volo.Abp.sln b/framework/Volo.Abp.sln index b46a8094039..3373a239dee 100644 --- a/framework/Volo.Abp.sln +++ b/framework/Volo.Abp.sln @@ -465,6 +465,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Volo.Abp.Imaging.SkiaSharp. EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Volo.Abp.RemoteServices.Tests", "test\Volo.Abp.RemoteServices.Tests\Volo.Abp.RemoteServices.Tests.csproj", "{DACD4485-61BE-4DE5-ACAE-4FFABC122500}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Volo.Abp.AspNetCore.Abstractions", "src\Volo.Abp.AspNetCore.Abstractions\Volo.Abp.AspNetCore.Abstractions.csproj", "{E1051CD0-9262-4869-832D-B951723F4DDE}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -1387,6 +1389,10 @@ Global {DACD4485-61BE-4DE5-ACAE-4FFABC122500}.Debug|Any CPU.Build.0 = Debug|Any CPU {DACD4485-61BE-4DE5-ACAE-4FFABC122500}.Release|Any CPU.ActiveCfg = Release|Any CPU {DACD4485-61BE-4DE5-ACAE-4FFABC122500}.Release|Any CPU.Build.0 = Release|Any CPU + {E1051CD0-9262-4869-832D-B951723F4DDE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E1051CD0-9262-4869-832D-B951723F4DDE}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E1051CD0-9262-4869-832D-B951723F4DDE}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E1051CD0-9262-4869-832D-B951723F4DDE}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -1621,6 +1627,7 @@ Global {198683D0-7DC6-40F2-B81B-8E446E70A9DE} = {5DF0E140-0513-4D0D-BE2E-3D4D85CD70E6} {DFAF8763-D1D6-4EB4-B459-20E31007FE2F} = {447C8A77-E5F0-4538-8687-7383196D04EA} {DACD4485-61BE-4DE5-ACAE-4FFABC122500} = {447C8A77-E5F0-4538-8687-7383196D04EA} + {E1051CD0-9262-4869-832D-B951723F4DDE} = {5DF0E140-0513-4D0D-BE2E-3D4D85CD70E6} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {BB97ECF4-9A84-433F-A80B-2A3285BDD1D5} diff --git a/framework/src/Volo.Abp.AspNetCore.Abstractions/FodyWeavers.xml b/framework/src/Volo.Abp.AspNetCore.Abstractions/FodyWeavers.xml new file mode 100644 index 00000000000..1715698ccd2 --- /dev/null +++ b/framework/src/Volo.Abp.AspNetCore.Abstractions/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/framework/src/Volo.Abp.AspNetCore.Abstractions/FodyWeavers.xsd b/framework/src/Volo.Abp.AspNetCore.Abstractions/FodyWeavers.xsd new file mode 100644 index 00000000000..ffa6fc4b782 --- /dev/null +++ b/framework/src/Volo.Abp.AspNetCore.Abstractions/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.AspNetCore.Abstractions/Volo.Abp.AspNetCore.Abstractions.csproj b/framework/src/Volo.Abp.AspNetCore.Abstractions/Volo.Abp.AspNetCore.Abstractions.csproj new file mode 100644 index 00000000000..c96dbc0c7ba --- /dev/null +++ b/framework/src/Volo.Abp.AspNetCore.Abstractions/Volo.Abp.AspNetCore.Abstractions.csproj @@ -0,0 +1,23 @@ + + + + + + + netstandard2.0;netstandard2.1;net8.0 + enable + Nullable + Volo.Abp.AspNetCore.Abstractions + Volo.Abp.AspNetCore.Abstractions + $(AssetTargetFallback);portable-net45+win8+wp8+wpa81; + false + false + false + + + + + + + + diff --git a/framework/src/Volo.Abp.AspNetCore.Abstractions/Volo/Abp/AspNetCore/AbpAspNetCoreAbstractionsModule.cs b/framework/src/Volo.Abp.AspNetCore.Abstractions/Volo/Abp/AspNetCore/AbpAspNetCoreAbstractionsModule.cs new file mode 100644 index 00000000000..6a15c5550f3 --- /dev/null +++ b/framework/src/Volo.Abp.AspNetCore.Abstractions/Volo/Abp/AspNetCore/AbpAspNetCoreAbstractionsModule.cs @@ -0,0 +1,15 @@ +using Microsoft.Extensions.DependencyInjection; +using Volo.Abp.AspNetCore.VirtualFileSystem; +using Volo.Abp.AspNetCore.WebClientInfo; +using Volo.Abp.Modularity; + +namespace Volo.Abp.AspNetCore; + +public class AbpAspNetCoreAbstractionsModule : AbpModule +{ + public override void ConfigureServices(ServiceConfigurationContext context) + { + context.Services.AddSingleton(); + context.Services.AddSingleton();; + } +} diff --git a/framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/Filters/IAbpFilter.cs b/framework/src/Volo.Abp.AspNetCore.Abstractions/Volo/Abp/AspNetCore/Filters/IAbpFilter.cs similarity index 100% rename from framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/Filters/IAbpFilter.cs rename to framework/src/Volo.Abp.AspNetCore.Abstractions/Volo/Abp/AspNetCore/Filters/IAbpFilter.cs diff --git a/framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/VirtualFileSystem/IWebContentFileProvider.cs b/framework/src/Volo.Abp.AspNetCore.Abstractions/Volo/Abp/AspNetCore/VirtualFileSystem/IWebContentFileProvider.cs similarity index 100% rename from framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/VirtualFileSystem/IWebContentFileProvider.cs rename to framework/src/Volo.Abp.AspNetCore.Abstractions/Volo/Abp/AspNetCore/VirtualFileSystem/IWebContentFileProvider.cs diff --git a/framework/src/Volo.Abp.AspNetCore.Abstractions/Volo/Abp/AspNetCore/VirtualFileSystem/NullWebContentFileProvider.cs b/framework/src/Volo.Abp.AspNetCore.Abstractions/Volo/Abp/AspNetCore/VirtualFileSystem/NullWebContentFileProvider.cs new file mode 100644 index 00000000000..a690c36062f --- /dev/null +++ b/framework/src/Volo.Abp.AspNetCore.Abstractions/Volo/Abp/AspNetCore/VirtualFileSystem/NullWebContentFileProvider.cs @@ -0,0 +1,22 @@ +using Microsoft.Extensions.FileProviders; +using Microsoft.Extensions.Primitives; + +namespace Volo.Abp.AspNetCore.VirtualFileSystem; + +public class NullWebContentFileProvider : IWebContentFileProvider +{ + public virtual IFileInfo GetFileInfo(string subpath) + { + return new NotFoundFileInfo(subpath); + } + + public virtual IDirectoryContents GetDirectoryContents(string subpath) + { + return new NotFoundDirectoryContents(); + } + + public virtual IChangeToken Watch(string filter) + { + return NullChangeToken.Singleton; + } +} diff --git a/framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/WebClientInfo/IWebClientInfoProvider.cs b/framework/src/Volo.Abp.AspNetCore.Abstractions/Volo/Abp/AspNetCore/WebClientInfo/IWebClientInfoProvider.cs similarity index 100% rename from framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/WebClientInfo/IWebClientInfoProvider.cs rename to framework/src/Volo.Abp.AspNetCore.Abstractions/Volo/Abp/AspNetCore/WebClientInfo/IWebClientInfoProvider.cs diff --git a/framework/src/Volo.Abp.AspNetCore.Abstractions/Volo/Abp/AspNetCore/WebClientInfo/NullWebClientInfoProvider.cs b/framework/src/Volo.Abp.AspNetCore.Abstractions/Volo/Abp/AspNetCore/WebClientInfo/NullWebClientInfoProvider.cs new file mode 100644 index 00000000000..9b83ffa4f39 --- /dev/null +++ b/framework/src/Volo.Abp.AspNetCore.Abstractions/Volo/Abp/AspNetCore/WebClientInfo/NullWebClientInfoProvider.cs @@ -0,0 +1,10 @@ +namespace Volo.Abp.AspNetCore.WebClientInfo; + +public class NullWebClientInfoProvider : IWebClientInfoProvider +{ + public virtual string? BrowserInfo { get; } + + public virtual string? ClientIpAddress { get; } + + public virtual string? DeviceInfo { get; } +} diff --git a/framework/src/Volo.Abp.AspNetCore/Volo.Abp.AspNetCore.csproj b/framework/src/Volo.Abp.AspNetCore/Volo.Abp.AspNetCore.csproj index 782fa652412..c6326e3e95a 100644 --- a/framework/src/Volo.Abp.AspNetCore/Volo.Abp.AspNetCore.csproj +++ b/framework/src/Volo.Abp.AspNetCore/Volo.Abp.AspNetCore.csproj @@ -20,6 +20,7 @@ + diff --git a/framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/AbpAspNetCoreModule.cs b/framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/AbpAspNetCoreModule.cs index bad4b7c491c..cda6aea27f1 100644 --- a/framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/AbpAspNetCoreModule.cs +++ b/framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/AbpAspNetCoreModule.cs @@ -25,7 +25,8 @@ namespace Volo.Abp.AspNetCore; typeof(AbpHttpModule), typeof(AbpAuthorizationModule), typeof(AbpValidationModule), - typeof(AbpExceptionHandlingModule) + typeof(AbpExceptionHandlingModule), + typeof(AbpAspNetCoreAbstractionsModule) )] public class AbpAspNetCoreModule : AbpModule { diff --git a/framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/VirtualFileSystem/WebContentFileProvider.cs b/framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/VirtualFileSystem/WebContentFileProvider.cs index fffc35792a2..9814dd8c970 100644 --- a/framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/VirtualFileSystem/WebContentFileProvider.cs +++ b/framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/VirtualFileSystem/WebContentFileProvider.cs @@ -10,6 +10,7 @@ namespace Volo.Abp.AspNetCore.VirtualFileSystem; +[Dependency(ReplaceServices = true)] public class WebContentFileProvider : IWebContentFileProvider, ISingletonDependency { private readonly IVirtualFileProvider _virtualFileProvider; diff --git a/framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/WebClientInfo/HttpContextWebClientInfoProvider.cs b/framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/WebClientInfo/HttpContextWebClientInfoProvider.cs index 13b5ab070c9..6e450efbcdd 100644 --- a/framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/WebClientInfo/HttpContextWebClientInfoProvider.cs +++ b/framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/WebClientInfo/HttpContextWebClientInfoProvider.cs @@ -6,6 +6,7 @@ namespace Volo.Abp.AspNetCore.WebClientInfo; +[Dependency(ReplaceServices = true)] public class HttpContextWebClientInfoProvider : IWebClientInfoProvider, ITransientDependency { protected ILogger Logger { get; } diff --git a/nupkg/common.ps1 b/nupkg/common.ps1 index 78de2aef440..9f014cd526f 100644 --- a/nupkg/common.ps1 +++ b/nupkg/common.ps1 @@ -97,6 +97,7 @@ $projects = ( "framework/src/Volo.Abp.AspNetCore.Authentication.JwtBearer", "framework/src/Volo.Abp.AspNetCore.Authentication.OAuth", "framework/src/Volo.Abp.AspNetCore.Authentication.OpenIdConnect", + "framework/src/Volo.Abp.AspNetCore.Abstractions", "framework/src/Volo.Abp.AspNetCore", "framework/src/Volo.Abp.AspNetCore.Mvc.Dapr", "framework/src/Volo.Abp.AspNetCore.Mvc.Dapr.EventBus",