Click or drag to resize

ServiceHelperLocateServiceT Method (Type, Object, IEnumerableT)

Convenience method for implementing IServiceProvider objects. If candidate is an instance of serviceType, returns candidate. Otherwise, checks additional IServiceProvider objects for any that return a non-null result for serviceType. Otherwise, returns .

Namespace:  AGI.Foundation.Infrastructure
Assembly:  AGI.Foundation.Core (in AGI.Foundation.Core.dll) Version: 22.2.414.0 (22.2.414.0)
Syntax
public static Object LocateService<T>(
	Type serviceType,
	Object candidate,
	IEnumerable<T> additionalServiceProviders
)
where T : IServiceProvider

Parameters

serviceType
Type: SystemType
The type of the service that is requested.
candidate
Type: SystemObject
A candidate object that could be of the requested serviceType.
additionalServiceProviders
Type: System.Collections.GenericIEnumerableT
Additional service providers that will be checked, in order, for the requested service. The first non-null result will be returned.

Type Parameters

T
The type of additional service providers to search.

Return Value

Type: Object
The requested service, or if not found.
Exceptions
ExceptionCondition
ArgumentNullException Thrown when serviceType, candidate, or additionalServiceProviders is .
See Also