Joutsen v0.5.0+18-g5fdf104
Loading...
Searching...
No Matches
Static Public Member Functions | List of all members
Joutsen.DependencyInjection.ServiceProvider Class Reference

Extension methods for the service provider that help creating instances when using dependency injection. More...

Static Public Member Functions

static ServiceType GetServiceWith< ServiceType > (this IServiceProvider provider, params object[] parameters)
 Fetches a service with additional parameters which are not services.
 
static object GetServiceWith (this IServiceProvider provider, Type serviceType, params object[] parameters)
 Fetches a service with additional parameters which are not services.
 

Detailed Description

Extension methods for the service provider that help creating instances when using dependency injection.

Since
0.5.0

Member Function Documentation

◆ GetServiceWith()

static object Joutsen.DependencyInjection.ServiceProvider.GetServiceWith ( this IServiceProvider  provider,
Type  serviceType,
params object[]  parameters 
)
static

Fetches a service with additional parameters which are not services.

Parameters
providerthe service provider
serviceTypethe type of the service to retrieve
parametersthe additional (non-service) parameters used to create the service
Returns
an instance of the service
Remarks
The provided parameters are resolved left to right and used for the first parameter with a matching type.

◆ GetServiceWith< ServiceType >()

static ServiceType Joutsen.DependencyInjection.ServiceProvider.GetServiceWith< ServiceType > ( this IServiceProvider  provider,
params object[]  parameters 
)
static

Fetches a service with additional parameters which are not services.

Parameters
providerthe service provider
parametersthe additional (non-service) parameters used to create the service
Returns
an instance of the service
Remarks
The provided parameters are resolved left to right and used for the first parameter with a matching type.
Type Constraints
ServiceType :class