Class ServiceProvider<TBase>
An immutable implementation of IServiceProvider that will index services that implement the TBase
interface.
When a service is added to a ServiceProvider<TBase>, an mapping is created between the type of this object and the object itself,
but also between the type of any interface derived from TBase
and implemented by this object.
Namespace: Metalama.Framework.Engine.Services
Assembly: Metalama.Framework.Sdk.dll
Syntax
public sealed class ServiceProvider<TBase> : ServiceProvider, IServiceProvider<TBase> where TBase : class
Type Parameters
Name | Description |
---|---|
TBase |
Properties
Name | Description |
---|---|
Empty |
Methods
Name | Description |
---|---|
Dispose() | |
GetService(Type) | Gets the implementation of a given service type. |
GetService<T>() | |
ToString() | |
WithService(TBase, Boolean) | Returns a new ServiceProvider<TBase> where a service have been added to the current ServiceProvider<TBase>. If the new service is already present in the current ServiceProvider<TBase>, it is replaced in the new ServiceProvider<TBase>. |
WithService<T>(Func<ServiceProvider<TBase>, T>) | |
WithServiceConditional<T>(Func<ServiceProvider<TBase>, T>) | |
WithServices(TBase, TBase[]) | Returns a new ServiceProvider<TBase> where some given services have been added to the current ServiceProvider<TBase>. If some of the new services are already present in the current ServiceProvider<TBase>, they are replaced in the new ServiceProvider<TBase>. |
WithServices(IEnumerable<TBase>) | Returns a new ServiceProvider<TBase> where some given services have been added to the current ServiceProvider<TBase>. If some of the new services are already present in the current ServiceProvider<TBase>, they are replaced in the new ServiceProvider<TBase>. |
WithUntypedService(Type, Object) |