public DscReportingController(ILogger <DscController> logger, DscHandlerHelper dscHelper) { _logger = logger; _dscHelper = dscHelper; _dscHandler = _dscHelper.DefaultHandler; }
private void Init() { // _logger.LogInformation("constructing DSC Handler Provider Manager"); // var dscManager = new DscHandlerManager(); _logger.LogInformation("resolved the following DSC Handler Providers:"); foreach (var fpn in _dscManager.FoundProvidersNames) { _logger.LogInformation($" * [{fpn}]"); } _logger.LogInformation("resolving target Provider"); _defaultDscProvider = _dscManager.GetProvider(_settings.Provider); if (_defaultDscProvider == null) { throw new ArgumentException("invalid, missing or unresolved Provider name"); } _logger.LogInformation("applying optional DSC Handler parameters"); if (_settings.Params?.Count > 0) { _defaultDscProvider.SetParameters(_settings.Params); } _logger.LogInformation("producing DSC Handler"); _defaultDscHandler = _defaultDscProvider.Produce(); if (_defaultDscHandler == null) { throw new InvalidOperationException("failed to construct DSC Handler"); } // services.AddSingleton<IDscHandler>(dscHandler); // _logger.LogInformation($"Resolving DSC Handler Provider for [{settings?.Provider}]"); // var handlerProviderType = Type.GetType(settings?.Provider); // if (handlerProviderType == null) // throw new Exception("Unable to resolve DSC Handler Provider type (is the type specified fully?)"); // services.AddSingleton<DscHandlerConfig>(new DscHandlerConfig // { // InitParams = settings?.Params, // }); // services.AddSingleton( // typeof(IDscHandlerProvider), handlerProviderType); }