- ABP Framework version: 4.4.0
- UI type: Angular
- DB provider: EF Core
- Tiered (MVC) or Identity Server Separated (Angular): yes
I Have two questions:
- I Created a background process console application to handle longer, scheduled calculations. In that application I defined calculation scheduling settings provider:
public class TenantCalculationTimeSettingProvider : SettingDefinitionProvider
{
public override void Define(ISettingDefinitionContext context)
{
context.Add(
new SettingDefinition("CalculationTimeCronConf"
, "0 */1 * ? * *"
, new LocalizableString(typeof(TenantCalculationTimeSettingProvider), "configuration for time scheduled calculation")
,new LocalizableString(typeof(TenantCalculationTimeSettingProvider), "configuration for time scheduled calculation")
));
}
}
I cannot get the Define-method to fire no matter what I try. I have added the dependency to AbpSettingsModule and tried to register the provider manually
public override void ConfigureServices(ServiceConfigurationContext context)
{
Configure<AbpSettingOptions>(options =>
{
options.DefinitionProviders.Add<TenantCalculationTimeSettingProvider>();
});
}
If I add the same provider in my main web application it works. I'm I missing some dependency in my new application for the Define to work?
2 If I define the setting this way, is there an Angular component (In commersial package perhaps) that enables viewing and editing this setting?
6 Answer(s)
-
0
Hi,
Can you share a project to reproduce?
-
0
Not publicly unless I do a new similar but generic project.
-
0
Hi,
You can create a minimal project to reproduce it
-
0
OK, I have done that. How can I share this with you?
-
0
Please send it to my email : shiwei.liang@volosoft.com thanks.
-
0
Hi,
Setting definitions is lazy load, It will be loaded the first time you use it.
try:
public class BackgroundProcessManagerHostedService : IHostedService { private readonly IAbpApplicationWithExternalServiceProvider _application; private readonly IServiceProvider _serviceProvider; private readonly HelloWorldService _helloWorldService; private readonly ISettingProvider _settingProvider; public BackgroundProcessManagerHostedService( IAbpApplicationWithExternalServiceProvider application, IServiceProvider serviceProvider, HelloWorldService helloWorldService, ISettingProvider settingProvider) { _application = application; _serviceProvider = serviceProvider; _helloWorldService = helloWorldService; _settingProvider = settingProvider; } public async Task StartAsync(CancellationToken cancellationToken) { await _settingProvider.GetAllAsync(); _application.Initialize(_serviceProvider); _helloWorldService.SayHello(); } public Task StopAsync(CancellationToken cancellationToken) { _application.Shutdown(); return Task.CompletedTask; } }