ServiceProvider
Wisej.Services.ServiceProvider
Last updated
Wisej.Services.ServiceProvider
Last updated
Namespace: Wisej.Services
Assembly: Wisej.Framework (3.5.0.0)
Manages services for Wisej.NET's DI implementation.
Registers a scoped service.
Parameter | Type | Description |
---|---|---|
TService | The service to add. | |
Scope of the service. Default is Shared. |
Throws:
InvalidOperationException A service of type TService is already registered.
Registers a scoped service. Since 3.5.4
Parameter | Type | Description |
---|---|---|
serviceType | The type of the service to add. | |
Scope of the service. Default is Shared. |
Throws:
ArgumentNullException serviceType is null or empty.
InvalidOperationException A service of type serviceType is already registered.
Registers a scoped service.
Parameter | Type | Description |
---|---|---|
TService | The type of the service to add. | |
TImplementation | The type of the implementation to use. | |
Scope of the service. Default is Shared. |
Throws:
InvalidOperationException A service of type TService is already registered.
Registers a scoped service. Since 3.5.4
Parameter | Type | Description |
---|---|---|
serviceType | The type of the service to add. | |
implementationType | The type of the implementation to use. | |
Scope of the service. Default is Shared. |
Throws:
ArgumentNullException serviceType is null or empty.
ArgumentNullException implementationType is null or empty.
InvalidOperationException A service of type serviceType is already registered.
Registers a scoped service.
Parameter | Type | Description |
---|---|---|
TService | The type of the service to add. | |
implementationTypeName | The name of the type of the implementation; can be a fully qualified assembly + type name. | |
Scope of the service. Default is Shared. |
Using this overload allows the application to register a service implementation that is loaded dynamically when requested. If implementationTypeName is a fully qualified type name, including the assembly name, the assembly and type are loaded on demand. Throws:
ArgumentNullException implementationTypeName is null or empty.
InvalidOperationException A service of type TService is already registered.
Registers a scoped service. Since 3.5.4
Parameter | Type | Description |
---|---|---|
serviceType | The type of the service to add. | |
implementationTypeName | The name of the type of the implementation; can be a fully qualified assembly + type name. | |
Scope of the service. Default is Shared. |
Using this overload allows the application to register a service implementation that is loaded dynamically when requested. If implementationTypeName is a fully qualified type name, including the assembly name, the assembly and type are loaded on demand. Throws:
ArgumentNullException serviceType is null or empty.
ArgumentNullException implementationTypeName is null or empty.
InvalidOperationException A service of type serviceType is already registered.
Registers a scoped service.
Parameter | Type | Description |
---|---|---|
TService | The service to add. | |
serviceImplementation | Implementation for the TService . | |
Scope of the service. Default is Shared. |
Throws:
ArgumentNullException serviceImplementation is null.
InvalidCastException serviceImplementation cannot be assigned to TService .
InvalidOperationException A service of type TService is already registered.
Registers a scoped service. Since 3.5.4
Parameter | Type | Description |
---|---|---|
serviceType | The service to add. | |
serviceImplementation | Implementation for the serviceType . | |
Scope of the service. Default is Shared. |
Throws:
ArgumentNullException serviceType is null.
ArgumentNullException serviceImplementation is null.
InvalidCastException serviceImplementation cannot be assigned to serviceType .
InvalidOperationException A service of type serviceType is already registered.
Registers a scoped service.
Parameter | Type | Description |
---|---|---|
TService | The type of the service to add. | |
implementationFactory | Method for creating the TService instance. | |
Scope of the service. Default is Shared. |
Throws:
NullReferenceException implementationFactory is null.
InvalidOperationException A service of type TService is already registered.
Registers a scoped service. Since 3.5.4
Parameter | Type | Description |
---|---|---|
serviceType | The type of the service to add. | |
implementationFactory | Method for creating the serviceType instance. | |
Scope of the service. Default is Shared. |
Throws:
NullReferenceException serviceType is null.
NullReferenceException implementationFactory is null.
InvalidOperationException A service of type serviceType is already registered.
Returns the requested service.
Parameter | Type | Description |
---|---|---|
T | Type of the service to retrieve. |
Returns: T. An instance of T or null if the service is not found.
Returns the requested service.
Parameter | Type | Description |
---|---|---|
serviceType | Type of the service to add. |
Returns: Object. An instance of serviceType or null if the service is not found.
Throws:
ArgumentNullException serviceType is null.
Injects the services into the properties marked with the InjectAttribute attributed on the specified target object.
Parameter | Type | Description |
---|---|---|
target | Target object to inject dependencies into. |
Throws:
ArgumentNullException target is null.
Removes the specified service type from the service container.
Parameter | Type | Description |
---|---|---|
serviceType | Type of the service to remove. |
Throws:
ArgumentNullException serviceType is null.
lifetime
lifetime
lifetime
lifetime
lifetime
lifetime
lifetime
lifetime
lifetime
lifetime