From 4e4234bf75eefa818408a3b56d7b4d9b44b9be2f Mon Sep 17 00:00:00 2001 From: liangshiwei Date: Tue, 3 Jan 2023 14:46:07 +0800 Subject: [PATCH 1/3] Skipped if version could not parsed --- .../VoloNugetPackagesVersionUpdater.cs | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/VoloNugetPackagesVersionUpdater.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/VoloNugetPackagesVersionUpdater.cs index 578d010214..336594b130 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/VoloNugetPackagesVersionUpdater.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/VoloNugetPackagesVersionUpdater.cs @@ -182,8 +182,13 @@ public class VoloNugetPackagesVersionUpdater : ITransientDependency var versionAttribute = package.Attributes["Version"]; var currentVersion = versionAttribute.Value; - var currentSemanticVersion = SemanticVersion.Parse(currentVersion); - + var isVersionParsed = SemanticVersion.TryParse(currentVersion, out var currentSemanticVersion); + if (!isVersionParsed) + { + Logger.LogWarning("Could not parse package \"{0}\" version v{1}. Skipped.", packageId, currentVersion); + continue; + } + var isLeptonXPackage = packageId.Contains("LeptonX"); Logger.LogDebug("Checking package: \"{0}\" - Current version: {1}", packageId, currentSemanticVersion); @@ -194,7 +199,7 @@ public class VoloNugetPackagesVersionUpdater : ITransientDependency { continue; } - + if (await SpecifiedVersionExists(specifiedVersion, packageId)) { var specifiedSemanticVersion = SemanticVersion.Parse(specifiedVersion); @@ -235,12 +240,12 @@ public class VoloNugetPackagesVersionUpdater : ITransientDependency SemanticVersion latestVersion; if (currentSemanticVersion.IsPrerelease && !switchToStable) { - latestVersion = latestNugetReleaseCandidateVersion == null || isLeptonXPackage ? + latestVersion = latestNugetReleaseCandidateVersion == null || isLeptonXPackage ? await _nuGetService.GetLatestVersionOrNullAsync(packageId, includeReleaseCandidates: true) : latestNugetReleaseCandidateVersion; } else { - latestVersion = latestNugetVersion == null || isLeptonXPackage ? + latestVersion = latestNugetVersion == null || isLeptonXPackage ? await _nuGetService.GetLatestVersionOrNullAsync(packageId, includeReleaseCandidates: includeReleaseCandidates) : latestNugetVersion; } From b9f16b341e9d20777c1af271369f92df215785f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?= Date: Tue, 3 Jan 2023 17:04:16 +0300 Subject: [PATCH 2/3] Set defaults while adding features --- .../Volo.Abp.Features/Volo/Abp/Features/FeatureCheckerBase.cs | 2 +- .../Volo.Abp.Features/Volo/Abp/Features/FeatureDefinition.cs | 4 ++-- .../Volo/Abp/FeatureManagement/FeatureDefinitionRecord.cs | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/framework/src/Volo.Abp.Features/Volo/Abp/Features/FeatureCheckerBase.cs b/framework/src/Volo.Abp.Features/Volo/Abp/Features/FeatureCheckerBase.cs index f94be12ba1..893b5bbc1c 100644 --- a/framework/src/Volo.Abp.Features/Volo/Abp/Features/FeatureCheckerBase.cs +++ b/framework/src/Volo.Abp.Features/Volo/Abp/Features/FeatureCheckerBase.cs @@ -11,7 +11,7 @@ public abstract class FeatureCheckerBase : IFeatureChecker, ITransientDependency public virtual async Task IsEnabledAsync(string name) { var value = await GetOrNullAsync(name); - if (value == null) + if (value.IsNullOrEmpty()) { return false; } diff --git a/framework/src/Volo.Abp.Features/Volo/Abp/Features/FeatureDefinition.cs b/framework/src/Volo.Abp.Features/Volo/Abp/Features/FeatureDefinition.cs index 5ea7377fd7..14cd0d405b 100644 --- a/framework/src/Volo.Abp.Features/Volo/Abp/Features/FeatureDefinition.cs +++ b/framework/src/Volo.Abp.Features/Volo/Abp/Features/FeatureDefinition.cs @@ -100,11 +100,11 @@ public class FeatureDefinition : ICanCreateChildFeature bool isVisibleToClients = true, bool isAvailableToHost = true) { - Name = name; + Name = Check.NotNullOrWhiteSpace(name, nameof(name)); DefaultValue = defaultValue; DisplayName = displayName ?? new FixedLocalizableString(name); Description = description; - ValueType = valueType; + ValueType = valueType ?? new ToggleStringValueType(); IsVisibleToClients = isVisibleToClients; IsAvailableToHost = isAvailableToHost; diff --git a/modules/feature-management/src/Volo.Abp.FeatureManagement.Domain/Volo/Abp/FeatureManagement/FeatureDefinitionRecord.cs b/modules/feature-management/src/Volo.Abp.FeatureManagement.Domain/Volo/Abp/FeatureManagement/FeatureDefinitionRecord.cs index 618f52d7a1..0c181ab632 100644 --- a/modules/feature-management/src/Volo.Abp.FeatureManagement.Domain/Volo/Abp/FeatureManagement/FeatureDefinitionRecord.cs +++ b/modules/feature-management/src/Volo.Abp.FeatureManagement.Domain/Volo/Abp/FeatureManagement/FeatureDefinitionRecord.cs @@ -70,7 +70,7 @@ public class FeatureDefinitionRecord : BasicAggregateRoot, IHasExtraProper DisplayName = Check.NotNullOrWhiteSpace(displayName, nameof(displayName), FeatureDefinitionRecordConsts.MaxDisplayNameLength); Description = Check.Length(description, nameof(description), FeatureDefinitionRecordConsts.MaxDescriptionLength); - DefaultValue = Check.NotNullOrWhiteSpace(defaultValue, nameof(defaultValue), FeatureDefinitionRecordConsts.MaxDefaultValueLength); + DefaultValue = Check.Length(defaultValue, nameof(defaultValue), FeatureDefinitionRecordConsts.MaxDefaultValueLength); IsVisibleToClients = isVisibleToClients; IsAvailableToHost = isAvailableToHost; From e2eaa1dd37d680968a17218082191363f2c7cc88 Mon Sep 17 00:00:00 2001 From: maliming Date: Wed, 4 Jan 2023 09:18:17 +0800 Subject: [PATCH 3/3] Disable `Transaction`. --- .../AbpFeatureManagementEntityFrameworkCoreTestModule.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/modules/feature-management/test/Volo.Abp.FeatureManagement.EntityFrameworkCore.Tests/Volo/Abp/FeatureManagement/EntityFrameworkCore/AbpFeatureManagementEntityFrameworkCoreTestModule.cs b/modules/feature-management/test/Volo.Abp.FeatureManagement.EntityFrameworkCore.Tests/Volo/Abp/FeatureManagement/EntityFrameworkCore/AbpFeatureManagementEntityFrameworkCoreTestModule.cs index f1a0a4bf3b..e85e246094 100644 --- a/modules/feature-management/test/Volo.Abp.FeatureManagement.EntityFrameworkCore.Tests/Volo/Abp/FeatureManagement/EntityFrameworkCore/AbpFeatureManagementEntityFrameworkCoreTestModule.cs +++ b/modules/feature-management/test/Volo.Abp.FeatureManagement.EntityFrameworkCore.Tests/Volo/Abp/FeatureManagement/EntityFrameworkCore/AbpFeatureManagementEntityFrameworkCoreTestModule.cs @@ -5,6 +5,7 @@ using Microsoft.EntityFrameworkCore.Storage; using Volo.Abp.EntityFrameworkCore; using Volo.Abp.EntityFrameworkCore.Sqlite; using Volo.Abp.Modularity; +using Volo.Abp.Uow; namespace Volo.Abp.FeatureManagement.EntityFrameworkCore; @@ -26,6 +27,11 @@ public class AbpFeatureManagementEntityFrameworkCoreTestModule : AbpModule abpDbContextConfigurationContext.DbContextOptions.UseSqlite(sqliteConnection); }); }); + + Configure(options => + { + options.TransactionBehavior = UnitOfWorkTransactionBehavior.Disabled; + }); } private static SqliteConnection CreateDatabaseAndGetConnection()