Open Closed

Customizing AbpApplicationConfigurationAppService #3830


User avatar
0
sh_erfan created
  • ABP Framework version: 5.2.1
  • UI type: MVC
  • DB provider: EF Core
  • Tiered (MVC) or Identity Server Separated (Angular): yes

Hi I tried to override some methods in AbpApplicationConfigurationAppService class as follow:

public class CustomApplicationConfigurationAppService :
            AbpApplicationConfigurationAppService
        {

        public CustomApplicationConfigurationAppService(
            IOptions<AbpLocalizationOptions> localizationOptions,
            IOptions<AbpMultiTenancyOptions> multiTenancyOptions,
            IServiceProvider serviceProvider,
            IAbpAuthorizationPolicyProvider abpAuthorizationPolicyProvider,
            IPermissionDefinitionManager permissionDefinitionManager,
            DefaultAuthorizationPolicyProvider defaultAuthorizationPolicyProvider,
            IPermissionChecker permissionChecker,
            IAuthorizationService authorizationService,
            ICurrentUser currentUser,
            ISettingProvider settingProvider,
            ISettingDefinitionManager settingDefinitionManager,
            IFeatureDefinitionManager featureDefinitionManager,
            ILanguageProvider languageProvider,
            ITimezoneProvider timezoneProvider,
            IOptions<AbpClockOptions> abpClockOptions,
            ICachedObjectExtensionsDtoService cachedObjectExtensionsDtoService)
            : base(localizationOptions, multiTenancyOptions, serviceProvider, abpAuthorizationPolicyProvider,
                permissionDefinitionManager, defaultAuthorizationPolicyProvider, permissionChecker,
                authorizationService,
                currentUser, settingProvider, settingDefinitionManager, featureDefinitionManager, languageProvider,
                timezoneProvider, abpClockOptions, cachedObjectExtensionsDtoService)
        {

        }



        protected override async Task<ApplicationLocalizationConfigurationDto> GetLocalizationConfigAsync()
        {
            var localizationConfig = new ApplicationLocalizationConfigurationDto();
            return localizationConfig;
        }

    }

Add replaced using traditional style in my ApplicationModule.cs : context.Services.Replace(ServiceDescriptor.Transient<IAbpApplicationConfigurationAppService, CustomApplicationConfigurationAppService>());

when I GET /api/abp/application-configuration from swagger, the result is as expected and localization is empty: but when launching web project, the response from GET request to /Abp/ApplicationConfigurationScript contains all localization data:

Why is this happening? And what is the solution?


4 Answer(s)
  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    I can reproduce the problem, can you create a new project to reproduce and send it to me by email? shiwei.liang@volosoft.com Thanks.

  • User Avatar
    0
    sh_erfan created

    Hi,

    I can reproduce the problem, can you create a new project to reproduce and send it to me by email? shiwei.liang@volosoft.com Thanks.

    Hi. I sent the requested sample to your email address. Thanks.

  • User Avatar
    2
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    Because you are using the tiered architecture, you need to put the CustomApplicationConfigurationAppService in the .HttpApi project.

  • User Avatar
    0
    sh_erfan created

    Hi, Thanks. That solved the problem.

Made with ❤️ on ABP v9.1.0-preview. Updated on November 01, 2024, 05:35