Interface IReadonlyDependencyResolver
- Namespace
- Splat
- Assembly
- Splat.dll
An interface for interacting with a dependency resolver in a read-only fashion.
public interface IReadonlyDependencyResolver
- Extension Methods
Methods
GetService(Type?, string?)
Gets an instance of the given serviceType
. Must return null
if the service is not available (must not throw).
object? GetService(Type? serviceType, string? contract = null)
Parameters
serviceType
TypeThe object type.
contract
stringA optional value which will retrieve only a object registered with the same contract.
Returns
- object
The requested object, if found;
null
otherwise.
GetServices(Type?, string?)
Gets all instances of the given serviceType
. Must return an empty
collection if the service is not available (must not return null
or throw).
IEnumerable<object> GetServices(Type? serviceType, string? contract = null)
Parameters
serviceType
TypeThe object type.
contract
stringA optional value which will retrieve only objects registered with the same contract.
Returns
- IEnumerable<object>
A sequence of instances of the requested
serviceType
. The sequence should be empty (notnull
) if no objects of the given type are available.