Table of Contents

Class ExtendedServiceProvider

Namespace
Acuit.Pinpoint.Workflows
Assembly
Acuit.Pinpoint.Workflows.dll

A service provider that extends an inherited service provider.

public class ExtendedServiceProvider : IServiceProvider
Inheritance
ExtendedServiceProvider
Implements
Inherited Members
Extension Methods

Remarks

GetService(Type) provides services according to this logic:

  1. The services added via With(Type, object) or With<T>(T) are searched, in the order in which they were added. The first matching service type, if one is found, is returned. Note that service types must match exactly; added service types that are base types of the requested service type will not be matched.
  2. If a matching service was not found, an if an extending service provider was specified via the ExtendedServiceProvider(IServiceProvider, IServiceProvider) constructor, then it is used to try to obtain the service. If one is found (i.e., GetService(Type) did not return null, it is returned.
  3. If a matching service was not found, then the inherited service provider is used to try to provide the service.

Constructors

ExtendedServiceProvider(IServiceProvider)

Initializes a new instance of the ExtendedServiceProvider class.

public ExtendedServiceProvider(IServiceProvider inheritedServiceProvider)

Parameters

inheritedServiceProvider IServiceProvider

The inherited service provider, which will be used to provide services not specifically provided by this extended service provider.

Remarks

See the remarks for ExtendedServiceProvider for details about the logic used to provide services.

Exceptions

ArgumentNullException

inheritedServiceProvider is null.

ExtendedServiceProvider(IServiceProvider, IServiceProvider)

Initializes a new instance of the ExtendedServiceProvider class.

public ExtendedServiceProvider(IServiceProvider inheritedServiceProvider, IServiceProvider extendingServiceProvider)

Parameters

inheritedServiceProvider IServiceProvider

The inherited service provider, which will be used to provide services not specifically provided by this extended service provider.

extendingServiceProvider IServiceProvider

A service provider that extends the services provided by inheritedServiceProvider.

Remarks

See the remarks for ExtendedServiceProvider for details about the logic used to provide services.

Exceptions

ArgumentNullException

inheritedServiceProvider is null.

ArgumentNullException

extendingServiceProvider is null.

ExtendedServiceProvider(IServiceProvider, params Tuple<Type, object>[])

[Obsolete("This is deprecated and will be removed in a future version; new ExtendedServiceProvider(IServiceProvider).With should be used instead.")]
public ExtendedServiceProvider(IServiceProvider inheritedServiceProvider, params Tuple<Type, object>[] newServices)

Parameters

inheritedServiceProvider IServiceProvider
newServices Tuple<Type, object>[]

Methods

GetService(Type)

Gets the service object of the specified type.

public object GetService(Type serviceType)

Parameters

serviceType Type

An object that specifies the type of service object to get.

Returns

object

A service object of type serviceType, or null if there is no service object of type serviceType.

Remarks

See the remarks for ExtendedServiceProvider for details about the logic used to provide services.

ServiceInstance<T>(T)

[Obsolete("This is deprecated and will be removed in a future version; new ExtendedServiceProvider(IServiceProvider).With should be used instead.")]
public static Tuple<Type, object> ServiceInstance<T>(T instance)

Parameters

instance T

Returns

Tuple<Type, object>

Type Parameters

T

With(Type, object)

Adds a service instance that this extended service provider can provide.

public ExtendedServiceProvider With(Type serviceType, object serviceInstance)

Parameters

serviceType Type

The service type.

serviceInstance object

The service instance.

Returns

ExtendedServiceProvider

This ExtendedServiceProvider instance, to allow chaining calls to this method.

Remarks

See the remarks for ExtendedServiceProvider for details about the logic used to provide services.

Exceptions

ArgumentNullException

serviceType is null.

ArgumentNullException

serviceInstance is null.

With<T>(T)

Adds a service instance that this extended service provider can provide.

public ExtendedServiceProvider With<T>(T serviceInstance)

Parameters

serviceInstance T

The service instance.

Returns

ExtendedServiceProvider

This ExtendedServiceProvider instance, to allow chaining calls to this method.

Type Parameters

T

The service type.

Remarks

See the remarks for ExtendedServiceProvider for details about the logic used to provide services.

Exceptions

ArgumentNullException

serviceInstance is null.