Interface IServiceRegistrationBuilder
Interface for service registration builder.
Namespace: Kephas.Composition.Lite
Assembly: Kephas.Core.dll
Syntax
public interface IServiceRegistrationBuilder
Methods
| Improve this Doc View SourceAddMetadata(String, Object)
Adds metadata in form of (key, value) pairs.
Declaration
IServiceRegistrationBuilder AddMetadata(string key, object value)
Parameters
Type | Name | Description |
---|---|---|
System.String | key | The key. |
System.Object | value | The value. |
Returns
Type | Description |
---|---|
IServiceRegistrationBuilder | This builder. |
AllowMultiple()
Registers the service with multiple instances.
Declaration
IServiceRegistrationBuilder AllowMultiple()
Returns
Type | Description |
---|---|
IServiceRegistrationBuilder | This builder. |
AsSingleton()
Registers the service as a singleton.
Declaration
IServiceRegistrationBuilder AsSingleton()
Returns
Type | Description |
---|---|
IServiceRegistrationBuilder | This builder. |
AsTransient()
Registers the service as transient.
Declaration
IServiceRegistrationBuilder AsTransient()
Returns
Type | Description |
---|---|
IServiceRegistrationBuilder | This builder. |
Keyed(Type)
Sets the registration key to a super type of the service type.
Declaration
IServiceRegistrationBuilder Keyed(Type contractType)
Parameters
Type | Name | Description |
---|---|---|
System.Type | contractType | Type of the contract. |
Returns
Type | Description |
---|---|
IServiceRegistrationBuilder | This builder. |
Remarks
The registration type is the key to find the service. The registered service type is a subtype providing additional information, typically metadata.
WithFactory(Func<ICompositionContext, Object>)
Registers the service with the provided factory.
Declaration
IServiceRegistrationBuilder WithFactory(Func<ICompositionContext, object> factory)
Parameters
Type | Name | Description |
---|---|---|
System.Func<ICompositionContext, System.Object> | factory | The factory. |
Returns
Type | Description |
---|---|
IServiceRegistrationBuilder | This builder. |
WithInstance(Object)
Registers the service with the provided instance.
Declaration
IServiceRegistrationBuilder WithInstance(object instance)
Parameters
Type | Name | Description |
---|---|---|
System.Object | instance | The service instance. |
Returns
Type | Description |
---|---|
IServiceRegistrationBuilder | This builder. |
WithType(Type)
Registers the service with the provided implementation type.
Declaration
IServiceRegistrationBuilder WithType(Type implementationType)
Parameters
Type | Name | Description |
---|---|---|
System.Type | implementationType | The implementation type. |
Returns
Type | Description |
---|---|
IServiceRegistrationBuilder | This builder. |