/// <summary> /// Initialize a client instance with a specified identifier /// </summary> /// <param name="epId">An registered endpoint name or a valid service URL. /// If a valid url is specified and does not exist in the registry it will be automatically registered. /// </param> public RaciClient(string epId) : this() { epId = epId?.Trim() ?? ""; Logger.LogInformation($"Creating instance with identifier: '{epId}'"); if (string.IsNullOrWhiteSpace(epId)) { Logger.LogWarning($"Empty service identifer, endpoint will remain unset"); } else if (RaciServiceManager.IsValidUrl(epId)) { Endpoint = RaciServiceManager.GetEndpointByUrl(epId) ?? RaciServiceManager.AddEndpoint(epId) ?? throw new ApplicationException($"Unable to obtain registry entry for service: {epId}"); Logger.LogInformation($"Registry Entry: [{Endpoint.Name}].[{Endpoint.ServiceRoot}]"); } else { Endpoint = RaciServiceManager.GetEndpointByName(epId); if (Endpoint != null) { Logger.LogInformation($"Registry Entry: [{Endpoint.Name}].[{Endpoint.ServiceRoot}]"); } else { Logger.LogWarning($"Invalid service identifer: '{epId}', endpoint will remain unset"); } } if (Endpoint != null) { Logger.LogInformation($"Loading drivers for endpoint '{Endpoint.Name}'..."); Drivers.AddRange(RaciServiceManager.GetDrivers(Endpoint)); Logger.LogInformation($"\tFound {Drivers.Count} drivers:"); #if DEBUG foreach (var dtype in Drivers.Select(t => t.DriverType).Distinct().OrderBy(t => t)) { Logger.LogDebug($"\t[{dtype}]"); foreach (var drv in Drivers.Where(t => t.DriverType == dtype)) { Logger.LogDebug($"\t\t{drv.Name}"); } } #endif } }
public override void BoardDriver(params Driver[] driver) { Drivers.AddRange(driver); }