Browse Source
Refactor comparison logic in FeatureManager and SettingManager to use string.Equals for fallback value checks
pull/22628/head
maliming
12 months ago
No known key found for this signature in database
GPG Key ID: A646B9CB645ECEA4
2 changed files with
2 additions and
2 deletions
-
modules/feature-management/src/Volo.Abp.FeatureManagement.Domain/Volo/Abp/FeatureManagement/FeatureManager.cs
-
modules/setting-management/src/Volo.Abp.SettingManagement.Domain/Volo/Abp/SettingManagement/SettingManager.cs
|
|
@ -152,7 +152,7 @@ public class FeatureManager : IFeatureManager, ISingletonDependency |
|
|
await using (await providers[0].HandleContextAsync(providerName, providerKey)) |
|
|
await using (await providers[0].HandleContextAsync(providerName, providerKey)) |
|
|
{ |
|
|
{ |
|
|
var fallbackValue = await GetOrNullInternalAsync(name, providers[1].Name, null); |
|
|
var fallbackValue = await GetOrNullInternalAsync(name, providers[1].Name, null); |
|
|
if (fallbackValue.Value.Equals(value, StringComparison.OrdinalIgnoreCase)) |
|
|
if (string.Equals(fallbackValue.Value, value, StringComparison.OrdinalIgnoreCase)) |
|
|
{ |
|
|
{ |
|
|
//Clear the value if it's same as it's fallback value
|
|
|
//Clear the value if it's same as it's fallback value
|
|
|
value = null; |
|
|
value = null; |
|
|
|
|
|
@ -136,7 +136,7 @@ public class SettingManager : ISettingManager, ISingletonDependency |
|
|
if (providers.Count > 1 && !forceToSet && setting.IsInherited && value != null) |
|
|
if (providers.Count > 1 && !forceToSet && setting.IsInherited && value != null) |
|
|
{ |
|
|
{ |
|
|
var fallbackValue = await GetOrNullInternalAsync(name, providers[1].Name, null); |
|
|
var fallbackValue = await GetOrNullInternalAsync(name, providers[1].Name, null); |
|
|
if (fallbackValue.Equals(value, StringComparison.OrdinalIgnoreCase)) |
|
|
if (string.Equals(fallbackValue, value, StringComparison.OrdinalIgnoreCase)) |
|
|
{ |
|
|
{ |
|
|
//Clear the value if it's same as it's fallback value
|
|
|
//Clear the value if it's same as it's fallback value
|
|
|
value = null; |
|
|
value = null; |
|
|
|