- ABP Framework version: v2.9
- UI type: Angular
- Tiered (MVC) or Identity Server Seperated (Angular): no
Relating to Settings and Features.
- One of our most used API calls needs to receive up to 30 settings to create data for a View Model. We are concerned about the time this will take on each call. Is the settings System suitable for this style of usage? Will it be efficient?
- Thoughout our app we need to check both if a Feature is enabled and a Setting indicating is a particular user can use that feature (e.g. Invoice Feature is enabled for a tenant, but only some users have access). What would be the most efficient way to implement this?
3 Answer(s)
-
0
First of all, the settings with the same key is being cached, so the second call will not go to database. Also, you can inject
ISettingProvider
and useGetAllAsync()
to retrieve all. it's better than getting 30 of them.If you want to multiple features you can also inject
IFeatureValueRepository
see https://github.com/abpframework/abp/blob/dev/modules/feature-management/src/Volo.Abp.FeatureManagement.Domain/Volo/Abp/FeatureManagement/FeatureManagementStore.csin ABP v3.0 settings and permission usage will be refactored and will be made more performance
-
0
GetAllAsync
method internally uses a loop to get all values. It will only make writing simple, but performance will not be improved and there may be 100 settings, and only 40 of them are needed.I provide another solution here: https://support.abp.io/QA/Questions/263/Efficient-user-of-Settings-and-Features