public static IComponentHostServiceResponse Set(this IComponentHostServiceResponse response, MemberState state, string message)
        {
            response.State   = state;
            response.Message = message;

            return(response);
        }
        public async Task <IActionResult> StartComponent(string packageName)
        {
            IComponentHostServiceResponse serviceResponse = null;

            if (!packageName.IsIgnoreCaseOrdinalEqual(_host.ComponentConfiguration.Name))
            {
                return(StatusCode(StatusCodes.Status404NotFound, $"Package \"{packageName}\" is not the package loaded into system - expecting \"{ _host.ComponentConfiguration.Name}\""));
            }

            if (_host.HostState == HostState.AwaitingConfiguration)
            {
                serviceResponse = await _host.ApplyConfigurationAsync();
            }

            IComponentHostServiceResponse <IComponentSettings> componentResponse = await _host.StartComponentAsync();

            return(Ok((ComponentResponse: componentResponse, ServiceResponse: serviceResponse)));
        }
        public async Task <IActionResult> Start()
        {
            try
            {
                if (_host.HostState == HostState.AwaitingConfiguration)
                {
                    await _host.ApplyConfigurationAsync();
                }

                IComponentHostServiceResponse serviceRessponse = await _host.StartAsync();

                _logger.LogInformation("{Message} {@ObjectProperties}", "Start hosted services", _host);
                return(Ok(serviceRessponse));
            }
            catch (Exception ex)
            {
                _logger.LogError(ex, "{Message} {@ObjectProperties}", "Failed to start hosted services", _host);
                return(StatusCode(StatusCodes.Status500InternalServerError, ex.Message));
            }
        }