using JetBrains.Annotations; using Volo.Abp.Settings; namespace NPin.Framework.SettingManagement.Domain.Provider.Extensions; public static class UserSettingManagerExtensions { public static Task GetOrNullForUserAsync(this ISettingManager settingManager, [NotNull] string name, Guid userId, bool fallback = true) { return settingManager.GetOrNullAsync(name, UserSettingValueProvider.ProviderName, userId.ToString(), fallback); } public static Task GetOrNullForCurrentUserAsync(this ISettingManager settingManager, [NotNull] string name, bool fallback = true) { return settingManager.GetOrNullAsync(name, UserSettingValueProvider.ProviderName, null, fallback); } public static Task> GetAllForUserAsync(this ISettingManager settingManager, Guid userId, bool fallback = true) { return settingManager.GetAllAsync(UserSettingValueProvider.ProviderName, userId.ToString(), fallback); } public static Task> GetAllForCurrentUserAsync(this ISettingManager settingManager, bool fallback = true) { return settingManager.GetAllAsync(UserSettingValueProvider.ProviderName, null, fallback); } public static Task SetForUserAsync(this ISettingManager settingManager, Guid userId, [NotNull] string name, string? value, bool forceToSet = false) { return settingManager.SetAsync(name, value, UserSettingValueProvider.ProviderName, userId.ToString(), forceToSet); } public static Task SetForCurrentUserAsync(this ISettingManager settingManager, [NotNull] string name, string? value, bool forceToSet = false) { return settingManager.SetAsync(name, value, UserSettingValueProvider.ProviderName, null, forceToSet); } }