设置租户设置
Set tenant settings
我正在开发一个多租户应用程序,我的应用程序有一个 Currency
设置。
public class MyAppSettingProvider : SettingProvider
{
public override IEnumerable<SettingDefinition> GetSettingDefinitions(SettingDefinitionProviderContext context)
{
return new[]
{
new SettingDefinition(MyAppSettingDefinition.Currency, string.Empty, scopes: SettingScopes.Tenant, isVisibleToClients: true),
};
}
}
public static class MyAppSettingDefinition
{
public const string Currency = "MyApp.UserManagement.Currency";
}
我已经在下面的 PreInitialize()
方法中添加了它。
Configuration.Settings.Providers.Add<MyAppSettingProvider>();
我的问题:
现在,此设置只为默认租户创建条目,不会为其他租户创建条目。
所以,我的问题是:
如何设置租户特定设置?
会在租户创建时间吗?如果可以,那我可以再用MyAppSettingProvider
class吗?
- 我可以删除默认租户吗?因为host没有Tenant Id,而我有固定数量的租户,不需要default。
指导我,什么是支持样板架构的最佳实践..
how can I set Tenant Specific setting?
注入 ISettingManager
并执行:
_settingManager.ChangeSettingForTenantAsync(tenantId, MyAppSettingDefinition.Currency, "$");
Is it going to be on tenant creation time? if yes, then can I use MyAppSettingProvider class again?
设置不会自动创建。您可以在 TenantAppService
的 Create
方法中配置。
您可以(但不必)使用 MyAppSettingProvider
。 ISettingManager
就是你想要的。
Is it ok if I remove default Tenant? because host does not have Tenant Id, and I have fixed number of tenants where default is not required.
是的。为了方便和演示,它是由模板创建的。
what will be best practice that also supports boilerplate architecture..
阅读 Setting Management 上的文档。
我正在开发一个多租户应用程序,我的应用程序有一个 Currency
设置。
public class MyAppSettingProvider : SettingProvider
{
public override IEnumerable<SettingDefinition> GetSettingDefinitions(SettingDefinitionProviderContext context)
{
return new[]
{
new SettingDefinition(MyAppSettingDefinition.Currency, string.Empty, scopes: SettingScopes.Tenant, isVisibleToClients: true),
};
}
}
public static class MyAppSettingDefinition
{
public const string Currency = "MyApp.UserManagement.Currency";
}
我已经在下面的 PreInitialize()
方法中添加了它。
Configuration.Settings.Providers.Add<MyAppSettingProvider>();
我的问题:
现在,此设置只为默认租户创建条目,不会为其他租户创建条目。
所以,我的问题是:
如何设置租户特定设置?
会在租户创建时间吗?如果可以,那我可以再用
MyAppSettingProvider
class吗?- 我可以删除默认租户吗?因为host没有Tenant Id,而我有固定数量的租户,不需要default。
指导我,什么是支持样板架构的最佳实践..
how can I set Tenant Specific setting?
注入 ISettingManager
并执行:
_settingManager.ChangeSettingForTenantAsync(tenantId, MyAppSettingDefinition.Currency, "$");
Is it going to be on tenant creation time? if yes, then can I use MyAppSettingProvider class again?
设置不会自动创建。您可以在 TenantAppService
的 Create
方法中配置。
您可以(但不必)使用 MyAppSettingProvider
。 ISettingManager
就是你想要的。
Is it ok if I remove default Tenant? because host does not have Tenant Id, and I have fixed number of tenants where default is not required.
是的。为了方便和演示,它是由模板创建的。
what will be best practice that also supports boilerplate architecture..
阅读 Setting Management 上的文档。