You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If we expect the providerName to be unique, we should constrain it within SettingManagementOptions and take it by the FirstOrDefault method. But there are SkipWhile and TakeWhile.
So, I think ABP allows multiple providers with the same name. But then, if we set a value with this provider name, it will lose the value:
Retrieve fallbackValue from the second unique name of the providers, rather than the second provider's name.
varproviderName=providers.Select(provider =>provider.Name).Distinct().Skip(1).FirstOrDefault();if(providerNameis not null){varfallbackValue=awaitGetOrNullInternalAsync(name,providerName,null);}
Version
7.4.5
User Interface
Common (Default)
Database Provider
EF Core (Default)
Tiered or separate authentication server
None (Default)
Operation System
Windows (Default)
Other information
No response
The text was updated successfully, but these errors were encountered:
Is there an existing issue for this?
Description
It seems that
SettingManager
supports multiple providers with the same name, but there is an issue with this implementation.According to that:
SettingManager.GetOrNullInternalAsync(string name, string providerName, string providerKey, bool fallback = true)
:abp/modules/setting-management/src/Volo.Abp.SettingManagement.Domain/Volo/Abp/SettingManagement/SettingManager.cs
Lines 181 to 189 in b595ff4
If we expect the
providerName
to be unique, we should constrain it withinSettingManagementOptions
and take it by theFirstOrDefault
method. But there areSkipWhile
andTakeWhile
.So, I think ABP allows multiple providers with the same name. But then, if we set a value with this provider name, it will lose the value:
SettingManager.SetAsync(string name, string value, string providerName, string providerKey, bool forceToSet = false)
:abp/modules/setting-management/src/Volo.Abp.SettingManagement.Domain/Volo/Abp/SettingManagement/SettingManager.cs
Lines 136 to 144 in b595ff4
If the
providers
list contains providers named[ "U", "U", "T", ... ]
, thefallbackValue
will still be retrieved from the providers namedU
.And then, if the
value
equals thefallbackValue
, thevalue
will be set tonull
.SettingManager
will clear the value for each providerU
:abp/modules/setting-management/src/Volo.Abp.SettingManagement.Domain/Volo/Abp/SettingManagement/SettingManager.cs
Lines 150 to 156 in b595ff4
Reproduction Steps
ISettingManagementProvider
namedU
near the originUserSettingManagementProvider
.await SettingManager.SetAsync(key, value, "U", CurrentUser.Id);
.await SettingManager.GetAsync(key, "U", CurrentUser.Id);
Expected behavior
Retrieved the previously set value.
Actual behavior
Retrieved
null
.Regression?
No response
Known Workarounds
Retrieve
fallbackValue
from the second unique name of the providers, rather than the second provider's name.Version
7.4.5
User Interface
Common (Default)
Database Provider
EF Core (Default)
Tiered or separate authentication server
None (Default)
Operation System
Windows (Default)
Other information
No response
The text was updated successfully, but these errors were encountered: