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, 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 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-based registrations are not supported; contract parameters are ignored. 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 or contract-based resolution.

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.
Dispose
Inherited members