Show / Hide Table of Contents

Interface IResolvesServices

An object which may be used to resolve types that might be available in a IServiceProvider or which might need to be constructed using System.Activator.CreateInstance(System.Type).

Namespace: CSF.Validation.Bootstrap
Assembly: CSF.Validation.Abstractions.dll
Syntax
public interface IResolvesServices
Remarks

Generally-speaking, this should not be used for validation framework services. Instead, use plain dependency injection or an IServiceProvider. The purpose of this service is for resolution of third-party types/services which might not have been correctly set-up within dependency injection. This service provides other mechanisms by which attempts may be made to resolve the implementation, which would fail if we used just a service provider alone.

Methods

| Improve this Doc View Source

ResolveService<T>(Type)

Attempts to resolve an instance of the specified implementation type.

Declaration
T ResolveService<T>(Type implementationType)
Parameters
Type Name Description
System.Type implementationType

The type of the concrete implementation for the service.

Returns
Type Description
T

An instance of the requested service; this method will not return null, it will raise an exception instead.

Type Parameters
Name Description
T

The expected type of the service.

Remarks

Attempts to resolve an instance of the specified implementationType, or raises an exception if this is not possible. This might occur for user/developer-provided services, particularly if they are not correctly registered via dependency injection. This method will make attempts to resolve the service regardless, and might succeed where a plain IServiceProvider would fail.

Exceptions
Type Condition
ResolutionException

If a service instance could not be resolved successfully.

System.ArgumentNullException

If implementationType is null.

System.ArgumentException

If the implementationType does not derive from T.

  • Improve this Doc
  • View Source
In This Article
Back to top Generated by DocFX