Base solution for your next web application
Starts in:
01 DAYS
01 HRS
01 MIN
01 SEC
Open Closed

how to change default value of a setting from a variable in SettingsProvider #8578


User avatar
0
BobIngham created

In my SettingsProvider I want to be able to set a default value from a variable, tenancyName:

new SettingDefinition(
    name: NuageSettings.NuageTenantManagement.DocumentationContainer,
    defaultValue: GetTenantName(),
    scopes: SettingScopes.Tenant,
    displayName: null,
    description: null,
    group: null,
    isVisibleToClients: true,
    isInherited: true,
    customData: null),

Now, I have tried implementing a private method at the foot of the SettingsProvider called GetTenantName() but there is actually no way to return the tenancy name using the TenantManager synchronously. SettingDefinitions are returned using a synchronous method:

public override IEnumerable<SettingDefinition> GetSettingDefinitions(SettingDefinitionProviderContext context)

So how do I get the tenancy name and apply it as a default in my settings? The Use Case is that I have a document library held in Blob Storage, each tenant has a new library copied from a default library when the tenant is created. Some tenants may want to use a different or common library so it essential that they can change the setting.


2 Answer(s)
  • User Avatar
    0
    maliming created
    Support Team

    hi

    The default value is for all tenants without a specified setting. The default value is fixed.

    Based on the current settings design,I suggest that you specify it's DocumentationContainer setting for the tenant at runtime via code instead of using the default.

  • User Avatar
    0
    BobIngham created

    Thanks, @maliming. I will carry out the necessary changes in the AppSettingsProvider.