Skip to content

SimpleInjectorInitializer class

Defined in

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

Summary

View source

        Provides a simple dependency resolver implementation using a factory-based registration model compatible with Simple
        Injector patterns.

Applies to

net10.0, net9.0, net8.0, net462, net481

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

Implements: IDependencyResolver, IReadonlyDependencyResolver, IMutableDependencyResolver, IDisposable

Remarks

This class enables registration and resolution of services by type, supporting multiple factories per service. Contract registrations are held separately from the contract-less ones, so a contract registration is only ever returned to a caller that asks for the same contract and never overwrites the contract-less registration for the same service type. Thread safety is ensured for all registration and resolution operations. This implementation is suitable for scenarios where lightweight, in-memory dependency resolution is required without advanced features such as scopes.

Constructors

NameSummary
.ctor

Properties

NameSummary
RegisteredFactoriesGets dictionary of registered factories.

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.
DisposePerforms application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
Inherited members