Esempio n. 1
0
    public virtual async Task <ApplicationConfigurationDto> GetAsync()
    {
        //TODO: Optimize & cache..?

        Logger.LogDebug("Executing AbpApplicationConfigurationAppService.GetAsync()...");

        var result = new ApplicationConfigurationDto
        {
            Auth             = await GetAuthConfigAsync(),
            Features         = await GetFeaturesConfigAsync(),
            GlobalFeatures   = await GetGlobalFeaturesConfigAsync(),
            Localization     = await GetLocalizationConfigAsync(),
            CurrentUser      = GetCurrentUser(),
            Setting          = await GetSettingConfigAsync(),
            MultiTenancy     = GetMultiTenancy(),
            CurrentTenant    = GetCurrentTenant(),
            Timing           = await GetTimingConfigAsync(),
            Clock            = GetClockConfig(),
            ObjectExtensions = _cachedObjectExtensionsDtoService.Get()
        };

        Logger.LogDebug("Executed AbpApplicationConfigurationAppService.GetAsync().");

        return(result);
    }
        // public virtual async Task<ApplicationConfigurationDto> GetAsync () {
        //     //TODO: Optimize & cache..?

        //     Logger.LogDebug ("Executing RocketApplicationConfigurationAppService.GetAsync()...");

        //     var result = new ApplicationConfigurationDto {
        //         Auth = await GetAuthConfigAsync (),
        //         Features = await GetFeaturesConfigAsync (),
        //         Localization = await GetLocalizationConfigAsync (),
        //         CurrentUser = GetCurrentUser (),
        //         Setting = await GetSettingConfigAsync (),
        //         MultiTenancy = GetMultiTenancy (),
        //         CurrentTenant = GetCurrentTenant (),
        //         ObjectExtensions = _cachedObjectExtensionsDtoService.Get ()
        //     };

        //     Logger.LogDebug ("Executed RocketApplicationConfigurationAppService.GetAsync().");

        //     return result;
        // }

        public virtual async Task <ApplicationConfigurationDto> GetAsync()
        {
            var commonConfigurationCacheItem = await GetCommonConfigurationCacheItemAsync();

            var personalConfigurationCacheItem = await GetPersonalConfigurationCacheItemAsync();

            var result = new ApplicationConfigurationDto {
                Localization     = commonConfigurationCacheItem.Localization,
                Auth             = personalConfigurationCacheItem.Auth,
                Features         = personalConfigurationCacheItem.Features,
                Setting          = personalConfigurationCacheItem.Setting,
                MultiTenancy     = GetMultiTenancy(),
                CurrentTenant    = GetCurrentTenant(),
                CurrentUser      = GetCurrentUser(),
                ObjectExtensions = _cachedObjectExtensionsDtoService.Get()
            };

            return(result);
        }
Esempio n. 3
0
    public virtual async Task <ApplicationConfigurationDto> GetAsync()
    {
        //TODO: Optimize & cache..?

        Logger.LogDebug("Executing AbpApplicationConfigurationAppService.GetAsync()...");

        var result = new ApplicationConfigurationDto
        {
            Auth             = await GetAuthConfigAsync(),
            Features         = await GetFeaturesConfigAsync(),
            GlobalFeatures   = await GetGlobalFeaturesConfigAsync(),
            Localization     = await GetLocalizationConfigAsync(),
            CurrentUser      = GetCurrentUser(),
            Setting          = await GetSettingConfigAsync(),
            MultiTenancy     = GetMultiTenancy(),
            CurrentTenant    = GetCurrentTenant(),
            Timing           = await GetTimingConfigAsync(),
            Clock            = GetClockConfig(),
            ObjectExtensions = _cachedObjectExtensionsDtoService.Get(),
            ExtraProperties  = new ExtraPropertyDictionary()
        };

        if (_options.Contributors.Any())
        {
            using (var scope = _serviceProvider.CreateScope())
            {
                var context = new ApplicationConfigurationContributorContext(scope.ServiceProvider, result);
                foreach (var contributor in _options.Contributors)
                {
                    await contributor.ContributeAsync(context);
                }
            }
        }

        Logger.LogDebug("Executed AbpApplicationConfigurationAppService.GetAsync().");

        return(result);
    }