/// <summary> /// Registers a service using the specified service information. /// </summary> /// <param name="serviceInformation">The service information.</param> /// <exception cref="NullReferenceException">Error registering null service information.</exception> public virtual void RegisterService(TServiceInformation serviceInformation) { Validate(_getConnectionId()); if (serviceInformation == null) { throw new NullReferenceException("Error registering null service information."); } var service = Repository.GetService(serviceInformation.ServiceId); if (service == null) { service = new ResonanceHubRegisteredService <TServiceInformation>() { ConnectionId = _getConnectionId(), ServiceInformation = serviceInformation }; Repository.AddService(service); } else { service.ConnectionId = _getConnectionId(); service.ServiceInformation = serviceInformation; } foreach (var discoveryClient in _discoveryClients.ToList()) { var reportedService = FilterServiceInformation(serviceInformation, discoveryClient.Credentials); if (reportedService != null) { Invoke(ResonanceHubMethods.ServiceRegistered, discoveryClient.ConnectionId, reportedService); } } }
/// <summary> /// Stores a registered service. /// </summary> /// <param name="service">The service.</param> public void AddService(ResonanceHubRegisteredService <TServiceInformation> service) { _services.Add(service); }
/// <summary> /// Removes the registered service. /// </summary> /// <param name="service">The service.</param> public void RemoveService(ResonanceHubRegisteredService <TServiceInformation> service) { _services.Remove(service); }