Example #1
0
        public void SetFactoryCommand(ServiceEnum service, string command)
        {
            var temp = Factories.Find(x => x.ServiceName.Equals(service));

            if (temp == null)
            {
                throw new ArgumentException("Service {0} did not match any classes", service.ToString());
            }

            temp.SetCommands(new List <object> {
                command
            });
        }
        public string GetServiceUri(ServiceEnum serviceName)
        {
            // Transform from Enum to string
            var key = serviceName.ToString();

            _logger.LogInformation($"Locating Service URL with Key {key}");

            // Retrieve URL from Configuration
            var uri = _configuration[key];

            _logger.LogInformation($"Target Service URL is {uri}");

            if (uri == null)
            {
                throw new NullReferenceException(
                          $"Uri key for {key} has not been configured. Add to it UserSecrets or appsettings.json");
            }

            return(uri);
        }
        public XplatServiceController(ServiceEnum serviceName)
        {
            var services = ServiceController.GetServices(Environment.MachineName);

            serviceController = services.FirstOrDefault(sc => serviceName.ToString().Equals(sc.ServiceName, StringComparison.InvariantCultureIgnoreCase));
        }
 public XplatMonoServiceController(ServiceEnum serviceName)
 {
     serviceNameString = Regex.Replace(serviceName.ToString(), @"\A[A-Z]", m => m.ToString().ToLower());
 }