खुला हुआ बंद किया हुआ

Settings management ui and tenant specific settings #1797


User avatar
0
LW बनाया था
  • 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:

  1. 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 उत्तर (ओं)
  • User Avatar
    0
    liangshiwei बनाया था
    सहायता दल Fullstack Developer

    Hi,

    Can you share a project to reproduce?

  • User Avatar
    0
    LW बनाया था

    Not publicly unless I do a new similar but generic project.

  • User Avatar
    0
    liangshiwei बनाया था
    सहायता दल Fullstack Developer

    Hi,

    You can create a minimal project to reproduce it

  • User Avatar
    0
    LW बनाया था

    OK, I have done that. How can I share this with you?

  • User Avatar
    0
    liangshiwei बनाया था
    सहायता दल Fullstack Developer

    Please send it to my email : shiwei.liang@volosoft.com thanks.

  • User Avatar
    0
    liangshiwei बनाया था
    सहायता दल Fullstack Developer

    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;
        }
    }
    
Made with ❤️ on ABP v8.2.0-preview Updated on मार्च 25, 2024, 15:11