I have added my own setting provider with a tenant scope and added it to the preinitialize method of my module. I set these settings in
TenantRegistrationAppService.RegisterTenant
and I can modify them by adding a tab to
tenant.settings.component.html
and adding code to
TenantSettingsAppService.UpdateAllSettings
So far so good. One of these settings is a voucher code which must be unique as it will be used by an app to register with the system and the voucher code will find the tenant using unique voucher code setting. How do search for all settings given a unique name (App.NuageTenantManagement.VoucherCode) to ensure a modified value is unique and how do I find a tenant from the same unique voucher code setting?
6 Answer(s)
-
0
Inject IRepository<Setting, long> and do as you would for any other entity.
Markdown is supportedCopy & paste or drag & drop images (max 30 MB per image) -
0
Doh!!!! Thanks, Aaron.
Markdown is supportedCopy & paste or drag & drop images (max 30 MB per image) -
0
Hmmm, the problem, Aaron, is that settingsRepository only return those settings for the current tenant, how do I read settings for all tenants to ensure the value is unique?
Markdown is supportedCopy & paste or drag & drop images (max 30 MB per image) -
0
You can DisableFilter for IMayHaveTenant:
using (_unitOfWorkManager.Current.DisableFilter(AbpDataFilters.MayHaveTenant)) { var settings = _settingRepository.GetAllList(); }Read the documentation on Data Filters.
Markdown is supportedCopy & paste or drag & drop images (max 30 MB per image) -
0
Thanks, Aaron, that did the trick. Sorry about the niaivety, I am still in the learning -phase.
Markdown is supportedCopy & paste or drag & drop images (max 30 MB per image) -
0
It's fine. You'll get the hang of it in time to come!
Markdown is supportedCopy & paste or drag & drop images (max 30 MB per image)