From 1483da256ea8b58e52ab6044b4b82bfef89473c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?= Date: Fri, 14 Aug 2020 17:46:23 +0300 Subject: [PATCH] #5061 Initial Global Features System completed. --- framework/Volo.Abp.sln | 14 +++++++++ .../Volo.Abp.GlobalFeatures/FodyWeavers.xml | 3 ++ .../Volo.Abp.GlobalFeatures/FodyWeavers.xsd | 30 +++++++++++++++++++ .../Properties/AssemblyInfo.cs | 3 ++ .../Volo.Abp.GlobalFeatures.csproj | 21 +++++++++++++ .../GlobalFeatures/AbpGlobalFeaturesModule.cs | 9 ++++++ .../Volo/Abp/GlobalFeatures/GlobalFeature.cs | 2 +- .../GlobalFeatures/GlobalFeatureDictionary.cs | 2 +- .../GlobalFeatures/GlobalFeatureManager.cs | 4 +-- .../GlobalFeatureNameAttribute.cs | 2 +- .../GlobalFeatures/GlobalModuleFeatures.cs | 2 +- .../GlobalModuleFeaturesDictionary.cs | 2 +- .../Volo.Abp.GlobalFeatures.Tests.csproj | 16 ++++++++++ .../GlobalFeatureManager_Tests.cs | 23 ++++++++++++++ .../Volo.CmsKit.Domain.Shared.csproj | 1 + .../Volo/CmsKit/CmsKitDomainSharedModule.cs | 7 +++-- nupkg/common.ps1 | 1 + 17 files changed, 133 insertions(+), 9 deletions(-) create mode 100644 framework/src/Volo.Abp.GlobalFeatures/FodyWeavers.xml create mode 100644 framework/src/Volo.Abp.GlobalFeatures/FodyWeavers.xsd create mode 100644 framework/src/Volo.Abp.GlobalFeatures/Properties/AssemblyInfo.cs create mode 100644 framework/src/Volo.Abp.GlobalFeatures/Volo.Abp.GlobalFeatures.csproj create mode 100644 framework/src/Volo.Abp.GlobalFeatures/Volo/Abp/GlobalFeatures/AbpGlobalFeaturesModule.cs rename {modules/cms-kit/src/Volo.CmsKit.Domain.Shared => framework/src/Volo.Abp.GlobalFeatures}/Volo/Abp/GlobalFeatures/GlobalFeature.cs (97%) rename {modules/cms-kit/src/Volo.CmsKit.Domain.Shared => framework/src/Volo.Abp.GlobalFeatures}/Volo/Abp/GlobalFeatures/GlobalFeatureDictionary.cs (76%) rename {modules/cms-kit/src/Volo.CmsKit.Domain.Shared => framework/src/Volo.Abp.GlobalFeatures}/Volo/Abp/GlobalFeatures/GlobalFeatureManager.cs (94%) rename {modules/cms-kit/src/Volo.CmsKit.Domain.Shared => framework/src/Volo.Abp.GlobalFeatures}/Volo/Abp/GlobalFeatures/GlobalFeatureNameAttribute.cs (98%) rename {modules/cms-kit/src/Volo.CmsKit.Domain.Shared => framework/src/Volo.Abp.GlobalFeatures}/Volo/Abp/GlobalFeatures/GlobalModuleFeatures.cs (98%) rename {modules/cms-kit/src/Volo.CmsKit.Domain.Shared => framework/src/Volo.Abp.GlobalFeatures}/Volo/Abp/GlobalFeatures/GlobalModuleFeaturesDictionary.cs (91%) create mode 100644 framework/test/Volo.Abp.GlobalFeatures.Tests/Volo.Abp.GlobalFeatures.Tests.csproj create mode 100644 framework/test/Volo.Abp.GlobalFeatures.Tests/Volo/Abp/GlobalFeatures/GlobalFeatureManager_Tests.cs diff --git a/framework/Volo.Abp.sln b/framework/Volo.Abp.sln index 5778b054ed..3811a80ee8 100644 --- a/framework/Volo.Abp.sln +++ b/framework/Volo.Abp.sln @@ -323,6 +323,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Volo.Abp.BlobStoring.Aws", EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Volo.Abp.BlobStoring.Aws.Tests", "test\Volo.Abp.BlobStoring.Aws.Tests\Volo.Abp.BlobStoring.Aws.Tests.csproj", "{2CD3B26A-CA81-4279-8D5D-6A594517BB3F}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Volo.Abp.GlobalFeatures", "src\Volo.Abp.GlobalFeatures\Volo.Abp.GlobalFeatures.csproj", "{04F44063-C952-403A-815F-EFB778BDA125}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Volo.Abp.GlobalFeatures.Tests", "test\Volo.Abp.GlobalFeatures.Tests\Volo.Abp.GlobalFeatures.Tests.csproj", "{231F1581-AA21-44C3-BF27-51EB3AD5355C}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -961,6 +965,14 @@ Global {2CD3B26A-CA81-4279-8D5D-6A594517BB3F}.Debug|Any CPU.Build.0 = Debug|Any CPU {2CD3B26A-CA81-4279-8D5D-6A594517BB3F}.Release|Any CPU.ActiveCfg = Release|Any CPU {2CD3B26A-CA81-4279-8D5D-6A594517BB3F}.Release|Any CPU.Build.0 = Release|Any CPU + {04F44063-C952-403A-815F-EFB778BDA125}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {04F44063-C952-403A-815F-EFB778BDA125}.Debug|Any CPU.Build.0 = Debug|Any CPU + {04F44063-C952-403A-815F-EFB778BDA125}.Release|Any CPU.ActiveCfg = Release|Any CPU + {04F44063-C952-403A-815F-EFB778BDA125}.Release|Any CPU.Build.0 = Release|Any CPU + {231F1581-AA21-44C3-BF27-51EB3AD5355C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {231F1581-AA21-44C3-BF27-51EB3AD5355C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {231F1581-AA21-44C3-BF27-51EB3AD5355C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {231F1581-AA21-44C3-BF27-51EB3AD5355C}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -1124,6 +1136,8 @@ Global {8E49687A-E69F-49F2-8DB0-428D0883A937} = {447C8A77-E5F0-4538-8687-7383196D04EA} {50968CDE-1029-4051-B2E5-B69D0ECF2A18} = {5DF0E140-0513-4D0D-BE2E-3D4D85CD70E6} {2CD3B26A-CA81-4279-8D5D-6A594517BB3F} = {447C8A77-E5F0-4538-8687-7383196D04EA} + {04F44063-C952-403A-815F-EFB778BDA125} = {5DF0E140-0513-4D0D-BE2E-3D4D85CD70E6} + {231F1581-AA21-44C3-BF27-51EB3AD5355C} = {447C8A77-E5F0-4538-8687-7383196D04EA} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {BB97ECF4-9A84-433F-A80B-2A3285BDD1D5} diff --git a/framework/src/Volo.Abp.GlobalFeatures/FodyWeavers.xml b/framework/src/Volo.Abp.GlobalFeatures/FodyWeavers.xml new file mode 100644 index 0000000000..bc5a74a236 --- /dev/null +++ b/framework/src/Volo.Abp.GlobalFeatures/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + diff --git a/framework/src/Volo.Abp.GlobalFeatures/FodyWeavers.xsd b/framework/src/Volo.Abp.GlobalFeatures/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/framework/src/Volo.Abp.GlobalFeatures/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.GlobalFeatures/Properties/AssemblyInfo.cs b/framework/src/Volo.Abp.GlobalFeatures/Properties/AssemblyInfo.cs new file mode 100644 index 0000000000..e4ff8a95bd --- /dev/null +++ b/framework/src/Volo.Abp.GlobalFeatures/Properties/AssemblyInfo.cs @@ -0,0 +1,3 @@ +using System.Runtime.CompilerServices; + +[assembly:InternalsVisibleTo("Volo.Abp.GlobalFeatures.Tests")] diff --git a/framework/src/Volo.Abp.GlobalFeatures/Volo.Abp.GlobalFeatures.csproj b/framework/src/Volo.Abp.GlobalFeatures/Volo.Abp.GlobalFeatures.csproj new file mode 100644 index 0000000000..f4afe8f9f7 --- /dev/null +++ b/framework/src/Volo.Abp.GlobalFeatures/Volo.Abp.GlobalFeatures.csproj @@ -0,0 +1,21 @@ + + + + + + + netstandard2.0 + Volo.Abp.GlobalFeatures + Volo.Abp.GlobalFeatures + $(AssetTargetFallback);portable-net45+win8+wp8+wpa81; + false + false + false + + + + + + + + diff --git a/framework/src/Volo.Abp.GlobalFeatures/Volo/Abp/GlobalFeatures/AbpGlobalFeaturesModule.cs b/framework/src/Volo.Abp.GlobalFeatures/Volo/Abp/GlobalFeatures/AbpGlobalFeaturesModule.cs new file mode 100644 index 0000000000..d537e9f8fd --- /dev/null +++ b/framework/src/Volo.Abp.GlobalFeatures/Volo/Abp/GlobalFeatures/AbpGlobalFeaturesModule.cs @@ -0,0 +1,9 @@ +using Volo.Abp.Modularity; + +namespace Volo.Abp.GlobalFeatures +{ + public class AbpGlobalFeaturesModule : AbpModule + { + + } +} diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/Abp/GlobalFeatures/GlobalFeature.cs b/framework/src/Volo.Abp.GlobalFeatures/Volo/Abp/GlobalFeatures/GlobalFeature.cs similarity index 97% rename from modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/Abp/GlobalFeatures/GlobalFeature.cs rename to framework/src/Volo.Abp.GlobalFeatures/Volo/Abp/GlobalFeatures/GlobalFeature.cs index de9ae0232a..c7fc9304a8 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/Abp/GlobalFeatures/GlobalFeature.cs +++ b/framework/src/Volo.Abp.GlobalFeatures/Volo/Abp/GlobalFeatures/GlobalFeature.cs @@ -1,4 +1,4 @@ -using JetBrains.Annotations; +using JetBrains.Annotations; namespace Volo.Abp.GlobalFeatures { diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/Abp/GlobalFeatures/GlobalFeatureDictionary.cs b/framework/src/Volo.Abp.GlobalFeatures/Volo/Abp/GlobalFeatures/GlobalFeatureDictionary.cs similarity index 76% rename from modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/Abp/GlobalFeatures/GlobalFeatureDictionary.cs rename to framework/src/Volo.Abp.GlobalFeatures/Volo/Abp/GlobalFeatures/GlobalFeatureDictionary.cs index c8f68a1ab0..a81632f8d5 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/Abp/GlobalFeatures/GlobalFeatureDictionary.cs +++ b/framework/src/Volo.Abp.GlobalFeatures/Volo/Abp/GlobalFeatures/GlobalFeatureDictionary.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; namespace Volo.Abp.GlobalFeatures { diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/Abp/GlobalFeatures/GlobalFeatureManager.cs b/framework/src/Volo.Abp.GlobalFeatures/Volo/Abp/GlobalFeatures/GlobalFeatureManager.cs similarity index 94% rename from modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/Abp/GlobalFeatures/GlobalFeatureManager.cs rename to framework/src/Volo.Abp.GlobalFeatures/Volo/Abp/GlobalFeatures/GlobalFeatureManager.cs index 456aa74a07..79badfe4e7 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/Abp/GlobalFeatures/GlobalFeatureManager.cs +++ b/framework/src/Volo.Abp.GlobalFeatures/Volo/Abp/GlobalFeatures/GlobalFeatureManager.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; using JetBrains.Annotations; namespace Volo.Abp.GlobalFeatures @@ -17,7 +17,7 @@ namespace Volo.Abp.GlobalFeatures protected HashSet EnabledFeatures { get; } - private GlobalFeatureManager() + internal GlobalFeatureManager() { EnabledFeatures = new HashSet(); Configuration = new Dictionary(); diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/Abp/GlobalFeatures/GlobalFeatureNameAttribute.cs b/framework/src/Volo.Abp.GlobalFeatures/Volo/Abp/GlobalFeatures/GlobalFeatureNameAttribute.cs similarity index 98% rename from modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/Abp/GlobalFeatures/GlobalFeatureNameAttribute.cs rename to framework/src/Volo.Abp.GlobalFeatures/Volo/Abp/GlobalFeatures/GlobalFeatureNameAttribute.cs index 295c8727e6..0563712899 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/Abp/GlobalFeatures/GlobalFeatureNameAttribute.cs +++ b/framework/src/Volo.Abp.GlobalFeatures/Volo/Abp/GlobalFeatures/GlobalFeatureNameAttribute.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Linq; using System.Reflection; using JetBrains.Annotations; diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/Abp/GlobalFeatures/GlobalModuleFeatures.cs b/framework/src/Volo.Abp.GlobalFeatures/Volo/Abp/GlobalFeatures/GlobalModuleFeatures.cs similarity index 98% rename from modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/Abp/GlobalFeatures/GlobalModuleFeatures.cs rename to framework/src/Volo.Abp.GlobalFeatures/Volo/Abp/GlobalFeatures/GlobalModuleFeatures.cs index 9a8afd236d..7d1b844d45 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/Abp/GlobalFeatures/GlobalModuleFeatures.cs +++ b/framework/src/Volo.Abp.GlobalFeatures/Volo/Abp/GlobalFeatures/GlobalModuleFeatures.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; using System.Collections.Immutable; using JetBrains.Annotations; diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/Abp/GlobalFeatures/GlobalModuleFeaturesDictionary.cs b/framework/src/Volo.Abp.GlobalFeatures/Volo/Abp/GlobalFeatures/GlobalModuleFeaturesDictionary.cs similarity index 91% rename from modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/Abp/GlobalFeatures/GlobalModuleFeaturesDictionary.cs rename to framework/src/Volo.Abp.GlobalFeatures/Volo/Abp/GlobalFeatures/GlobalModuleFeaturesDictionary.cs index 9952b0c5cc..b89bf2fe36 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/Abp/GlobalFeatures/GlobalModuleFeaturesDictionary.cs +++ b/framework/src/Volo.Abp.GlobalFeatures/Volo/Abp/GlobalFeatures/GlobalModuleFeaturesDictionary.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; using JetBrains.Annotations; namespace Volo.Abp.GlobalFeatures diff --git a/framework/test/Volo.Abp.GlobalFeatures.Tests/Volo.Abp.GlobalFeatures.Tests.csproj b/framework/test/Volo.Abp.GlobalFeatures.Tests/Volo.Abp.GlobalFeatures.Tests.csproj new file mode 100644 index 0000000000..c0a973f8a5 --- /dev/null +++ b/framework/test/Volo.Abp.GlobalFeatures.Tests/Volo.Abp.GlobalFeatures.Tests.csproj @@ -0,0 +1,16 @@ + + + + + + netcoreapp3.1 + + + + + + + + + + diff --git a/framework/test/Volo.Abp.GlobalFeatures.Tests/Volo/Abp/GlobalFeatures/GlobalFeatureManager_Tests.cs b/framework/test/Volo.Abp.GlobalFeatures.Tests/Volo/Abp/GlobalFeatures/GlobalFeatureManager_Tests.cs new file mode 100644 index 0000000000..6d8e3a9d25 --- /dev/null +++ b/framework/test/Volo.Abp.GlobalFeatures.Tests/Volo/Abp/GlobalFeatures/GlobalFeatureManager_Tests.cs @@ -0,0 +1,23 @@ +using Shouldly; +using Xunit; + +namespace Volo.Abp.GlobalFeatures +{ + public class GlobalFeatureManager_Tests + { + private readonly GlobalFeatureManager _featureManeger; + + public GlobalFeatureManager_Tests() + { + _featureManeger = new GlobalFeatureManager(); + } + + [Fact] + public void Enable_Feature_By_Name() + { + _featureManeger.IsEnabled("Feature1").ShouldBeFalse(); + _featureManeger.Enable("Feature1"); + _featureManeger.IsEnabled("Feature1").ShouldBeTrue(); + } + } +} diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo.CmsKit.Domain.Shared.csproj b/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo.CmsKit.Domain.Shared.csproj index 03bc3bce5d..e5e84b7aca 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo.CmsKit.Domain.Shared.csproj +++ b/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo.CmsKit.Domain.Shared.csproj @@ -11,6 +11,7 @@ + diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/CmsKitDomainSharedModule.cs b/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/CmsKitDomainSharedModule.cs index 925acdaf79..d2490cfb37 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/CmsKitDomainSharedModule.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/CmsKitDomainSharedModule.cs @@ -1,4 +1,6 @@ -using Volo.Abp.Modularity; +using System; +using Volo.Abp.GlobalFeatures; +using Volo.Abp.Modularity; using Volo.Abp.Localization; using Volo.CmsKit.Localization; using Volo.Abp.Localization.ExceptionHandling; @@ -9,7 +11,8 @@ using Volo.Abp.VirtualFileSystem; namespace Volo.CmsKit { [DependsOn( - typeof(AbpValidationModule) + typeof(AbpValidationModule), + typeof(AbpGlobalFeaturesModule) )] public class CmsKitDomainSharedModule : AbpModule { diff --git a/nupkg/common.ps1 b/nupkg/common.ps1 index 99244d5d6c..58b8cf83cf 100644 --- a/nupkg/common.ps1 +++ b/nupkg/common.ps1 @@ -86,6 +86,7 @@ $projects = ( "framework/src/Volo.Abp.EventBus.RabbitMQ", "framework/src/Volo.Abp.Features", "framework/src/Volo.Abp.FluentValidation", + "framework/src/Volo.Abp.GlobalFeatures", "framework/src/Volo.Abp.Guids", "framework/src/Volo.Abp.HangFire", "framework/src/Volo.Abp.Http.Abstractions",