Skip to content

SimpleInjectorDependencyResolver class

Defined in

Namespace: Splat.SimpleInjector Assembly: Splat.SimpleInjector.dll Full name: Splat.SimpleInjector.SimpleInjectorDependencyResolver Modifiers: public

Summary

View source

        Provides an implementation of the IDependencyResolver interface using a SimpleInjector container for dependency
        resolution.
        

Applies to

net10.0, net10.0-browserwasm1.0, net10.0-desktop1.0, net9.0, net9.0-browserwasm1.0, net9.0-desktop1.0, net8.0, net8.0-ios17.5, net8.0-maccatalyst17.5, net8.0-macos14.2, net8.0-macos14.5, net8.0-tvos17.2, netstandard2.1, net462, net481, net471

Class hierarchy
classDiagram
class SimpleInjectorDependencyResolver
class IDependencyResolver {
    <>
}
IDependencyResolver <|.. SimpleInjectorDependencyResolver
class IReadonlyDependencyResolver {
    <>
}
IReadonlyDependencyResolver <|.. SimpleInjectorDependencyResolver
class IMutableDependencyResolver {
    <>
}
IMutableDependencyResolver <|.. SimpleInjectorDependencyResolver
class IDisposable {
    <>
}
IDisposable <|.. SimpleInjectorDependencyResolver

Implements: IDependencyResolver, IReadonlyDependencyResolver, IMutableDependencyResolver, IDisposable

Remarks

This resolver adapts a SimpleInjector Container to the IDependencyResolver abstraction, enabling integration with frameworks or components that expect this interface. Contract-based resolution is not natively supported by SimpleInjector; contract parameters are ignored and treated as standard resolution requests. Service unregistration and registration callbacks are not supported, as SimpleInjector does not provide mechanisms for removing registrations or observing registration events after initial configuration. The resolver manages the lifetime of the underlying container and disposes it when the resolver is disposed.

Constructors

NameSummary
.ctorInitializes a new instance of the [SimpleInjectorDependencyResolver](# class.

Methods

NameSummary
GetServiceGets an instance of the given serviceType. Must return null if the service is not available (must not throw).
GetServicesGets all instances of the given serviceType. Must return an empty collection if the service is not available (must not return null or throw).
HasRegistrationDetermines whether a registration exists for the specified service type.
RegisterRegisters a factory method for creating instances of the specified service type.
UnregisterCurrentUnregisters the current instance of the specified service type from the context.
UnregisterAllUnregisters all service registrations for the specified service type.
ServiceRegistrationCallbackRegisters a callback to be invoked when a service of the specified type is registered or becomes available.
RegisterConstantRegisters a constant value of the specified reference type for later retrieval or use.
RegisterLazySingletonRegisters a singleton service of type T that is created lazily using the specified factory function.
Dispose
Inherited members