Skip to main content
Version: 3.5

ServiceProvider

Namespace: Wisej.Services

Assembly: Wisej.Framework (3.5.0.0)

Manages services for Wisej.NET's DI implementation.

public class ServiceProvider : IServiceProvider

Methods

Instance memberAddService<TService>(lifetime)

Registers a scoped service.

ParameterTypeDescription
TServiceThe service to add.
lifetime optionalServiceLifetimeScope of the service. Default is Shared.

Throws:

Instance memberAddService(serviceType, lifetime)

Registers a scoped service. Since 3.5.4

ParameterTypeDescription
serviceTypeTypeThe type of the service to add.
lifetime optionalServiceLifetimeScope of the service. Default is Shared.

Throws:

Instance memberAddService<TService, TImplementation>(lifetime)

Registers a scoped service.

ParameterTypeDescription
TServiceThe type of the service to add.
TImplementationThe type of the implementation to use.
lifetime optionalServiceLifetimeScope of the service. Default is Shared.

Throws:

Instance memberAddService(serviceType, implementationType, lifetime)

Registers a scoped service. Since 3.5.4

ParameterTypeDescription
serviceTypeTypeThe type of the service to add.
implementationTypeTypeThe type of the implementation to use.
lifetime optionalServiceLifetimeScope of the service. Default is Shared.

Throws:

Instance memberAddService<TService>(implementationTypeName, lifetime)

Registers a scoped service.

ParameterTypeDescription
TServiceThe type of the service to add.
implementationTypeNameStringThe name of the type of the implementation; can be a fully qualified assembly + type name.
lifetime optionalServiceLifetimeScope 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:

Instance memberAddService(serviceType, implementationTypeName, lifetime)

Registers a scoped service. Since 3.5.4

ParameterTypeDescription
serviceTypeTypeThe type of the service to add.
implementationTypeNameStringThe name of the type of the implementation; can be a fully qualified assembly + type name.
lifetime optionalServiceLifetimeScope 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:

Instance memberAddService<TService>(serviceImplementation, lifetime)

Registers a scoped service.

ParameterTypeDescription
TServiceThe service to add.
serviceImplementationObjectImplementation for the TService .
lifetime optionalServiceLifetimeScope of the service. Default is Shared.

Throws:

Instance memberAddService(serviceType, serviceImplementation, lifetime)

Registers a scoped service. Since 3.5.4

ParameterTypeDescription
serviceTypeTypeThe service to add.
serviceImplementationObjectImplementation for the serviceType .
lifetime optionalServiceLifetimeScope of the service. Default is Shared.

Throws:

Instance memberAddService<TService>(implementationFactory, lifetime)

Registers a scoped service.

ParameterTypeDescription
TServiceThe type of the service to add.
implementationFactoryFunc<Type, Object>Method for creating the TService instance.
lifetime optionalServiceLifetimeScope of the service. Default is Shared.

Throws:

Instance memberAddService(serviceType, implementationFactory, lifetime)

Registers a scoped service. Since 3.5.4

ParameterTypeDescription
serviceTypeTypeThe type of the service to add.
implementationFactoryFunc<Type, Object>Method for creating the serviceType instance.
lifetime optionalServiceLifetimeScope of the service. Default is Shared.

Throws:

Instance memberGetService<T>()

Returns the requested service.

ParameterTypeDescription
TType of the service to retrieve.

Returns: T. An instance of T or null if the service is not found.

Instance memberGetService(serviceType)

Returns the requested service.

ParameterTypeDescription
serviceTypeTypeType of the service to add.

Returns: Object. An instance of serviceType or null if the service is not found.

Throws:

Instance memberInject(target)

Injects the services into the properties marked with the InjectAttribute attributed on the specified target object.

ParameterTypeDescription
targetObjectTarget object to inject dependencies into.

Throws:

Instance memberRemoveService(serviceType)

Removes the specified service type from the service container.

ParameterTypeDescription
serviceTypeTypeType of the service to remove.

Throws: