public async Task <SettingsViewModel> Handle(SettingsViewRequest request, CancellationToken cancellationToken) { ImmutableArray <ControllerRouteInfo> routesWithController = RouteList.GetRoutesWithController(Assemblies.FilteredAssemblies()); var info = new ConfigurationInfo(_configuration.SourceChain, _configuration.AllKeys .OrderBy(item => item) .Select(item => new ConfigurationKeyInfo(item, _configuration[item], _configuration.ConfiguratorFor(item).GetType().Name)) .ToImmutableArray()); ImmutableArray <ContainerRegistrationInfo> registrations = _scope.Deepest().Lifetime.ComponentRegistry .Registrations.SelectMany(reg => reg.Services.Select(service => new ContainerRegistrationInfo(service.Description, reg.Lifetime.ToString()))).ToImmutableArray(); IEnumerable <KeyValuePair <string, string> > aspNetConfigurationValues = _aspNetConfiguration .AsEnumerable() .Where(pair => !string.IsNullOrWhiteSpace(pair.Value)) .Select(pair => new KeyValuePair <string, string>(pair.Key, pair.Value.MakeAnonymous(pair.Key, StringExtensions.DefaultAnonymousKeyWords.ToArray()))); AppVersionInfo appVersionInfo = VersionHelper.GetAppVersion(); ImmutableArray <(object, string)> configurationValues = _scope.GetConfigurationValues(); IKeyValueConfiguration applicationMetadata = await GetApplicationMetadataAsync(cancellationToken); var settingsViewModel = new SettingsViewModel( _deploymentTargetReadService.GetType().Name, routesWithController, info, registrations, aspNetConfigurationValues, _loggingLevelSwitch.MinimumLevel, appVersionInfo, configurationValues, applicationMetadata); return(settingsViewModel); }
public async Task <SettingsViewModel> Handle(SettingsViewRequest request, CancellationToken cancellationToken) { var routesWithController = RouteList.GetRoutesWithController(_applicationAssemblyResolver.GetAssemblies()); var configurationValues = new ConfigurationInfo(_configuration.SourceChain, _configuration.AllKeys .OrderBy(key => key) .Select(key => new ConfigurationKeyInfo(key, _configuration[key].MakeAnonymous(key, ArborStringExtensions.DefaultAnonymousKeyWords.ToArray()), _configuration.ConfiguratorFor(key)?.GetType().Name)) .ToImmutableArray()); IEnumerable <KeyValuePair <string, string> > aspNetConfigurationValues = _aspNetConfiguration .AsEnumerable() .Where(pair => !string.IsNullOrWhiteSpace(pair.Value)) .Select(pair => new KeyValuePair <string, string>(pair.Key, pair.Value.MakeAnonymous(pair.Key, ArborStringExtensions.DefaultAnonymousKeyWords.ToArray()))); var applicationVersionInfo = ApplicationVersionHelper.GetAppVersion(); var serviceDiagnosticsRegistrations = _serviceDiagnostics.Registrations; IKeyValueConfiguration applicationMetadata = await GetApplicationMetadataAsync(cancellationToken); ServiceInstance?GetInstance(ServiceRegistrationInfo serviceRegistrationInfo) { Type registrationType = serviceRegistrationInfo.ServiceDescriptorServiceType; if (serviceRegistrationInfo.ServiceDescriptorImplementationInstance is { }) { return(new ServiceInstance(registrationType, serviceRegistrationInfo.ServiceDescriptorImplementationInstance, serviceRegistrationInfo.Module)); } if (serviceRegistrationInfo.Factory is { })