Setting is not cached for user if it does not exist in database

Author: dolphinsdCreated Sep 27, 2025Updated Jun 9, 2026

This issue only appears if user did not override a default settings. Since value is not database and returned as null in SettingStore.cs, setting extensions call will return null /// /// Creates new object from given object. /// public static SettingInfo ToSettingInfo(this Setting setting) { return setting == null ? null : new SettingInfo(setting.TenantId, setting.UserId, setting.Name, setting.Value); }

this result in repeat calls to database for setting that has not been overriden by user. SELECT TOP(1) [a].[Id], [a].[CreationTime], [a].[CreatorUserId], [a].[LastModificationTime], [a].[LastModifierUserId], [a].[Name], [a].[TenantId], [a].[UserId], [a].[Value] FROM [AbpSettings] AS [a] WHERE (@__ef_filter__p_1 = CAST(1 AS bit) OR [a].[TenantId] = @__ef_filter__CurrentTenantId_0) AND [a].[UserId] = @__userId_0 AND [a].[Name] = @__name_1 AND [a].[TenantId] = @__tenantId_2

SOLUTION: Once setting is established from tenant or application, cache that setting for user as value!

Source: aspnetboilerplate/aspnetboilerplate