Class ServiceRegistry
Base implementation for IServiceRegistry
public class ServiceRegistry : IServiceRegistry
- Inheritance
-
ServiceRegistry
- Implements
- Extension Methods
Fields
ServiceRegistryKey
public static readonly PropertyKey<IServiceRegistry> ServiceRegistryKey
Field Value
Methods
AddService<T>(T)
Adds a service to this ServiceRegistry.
public void AddService<T>(T service) where T : class
Parameters
service
TThe service to add.
Type Parameters
T
The type of service to add.
Exceptions
- ArgumentNullException
Service cannot be null
- ArgumentException
Service is already registered with this type
GetService<T>()
Gets the service object of the specified type.
public T GetService<T>() where T : class
Returns
- T
A service of the requested type, or [null] if not found.
Type Parameters
T
The type of the service to retrieve.
RemoveService<T>()
Removes the object providing a specified service.
public void RemoveService<T>() where T : class
Type Parameters
T
The type of the service to remove.
Events
ServiceAdded
Occurs when a new service is added.
public event EventHandler<ServiceEventArgs> ServiceAdded
Event Type
ServiceRemoved
Occurs when when a service is removed.
public event EventHandler<ServiceEventArgs> ServiceRemoved