Abp Commercial / 5.1.3 / EF / Blazor Server
Hi, How does one change a setting for a dependent module programmatically? We followed the documentation at: https://docs.abp.io/en/abp/4.4/Modules/Setting-Management#isettingmanager
We are attempting to set Abp.Account.IsSelfRegistrationEnabled to always be false for the host db only by using the SaasDataSeedContributer in our Domain project (see below). The problem is that the account module settings don't seem to be available to set as we receive the following exception when attempting to set the setting: Volo.Abp.AbpException: 'Undefined setting: Abp.Account.IsSelfRegistrationEnabled'
public virtual async Task SeedAsync(DataSeedContext context)
{
using (_currentTenant.Change(context?.TenantId))
{
await _editionDataSeeder.CreateStandardEditionsAsync();
if (context?.TenantId == null)
{
await _settingManager.SetForTenantOrGlobalAsync(null, "Abp.Account.IsSelfRegistrationEnabled", "False");
}
}
}
}
4 Answer(s)
-
0
Hi,
Setting definitions in the
..Account.Application
project. you can add theApplication
project reference to theDbMigrator
project. -
0
Hi,
Setting definitions in the
..Account.Application
project. you can add theApplication
project reference to theDbMigrator
project.Hi Liangshiwei,
I added our ...Application project reference to the DbMigrator project and I am still getting the same exception. The DataSeedContributer is in the Domain project. It needs to be there, correct? I tried adding a DataSeedContributer to the Application project, but DbMigrator does not discover the DataSeedContributer at runtime from that location.
-
0
Application project reference to the DbMigrator project and I am still getting the same exception
Did you add the module dependency?
[DependsOn( ..... typeof(...ApplicationModule) )] public class ...DbMigratorModule : AbpModule
-
0
Application project reference to the DbMigrator project and I am still getting the same exception
Did you add the module dependency?
[DependsOn( ..... typeof(...ApplicationModule) )] public class ...DbMigratorModule : AbpModule
That was it! Thanks for the support @liangshiwei