SimpleInjectorInitializer class¶
Attributes: [DebuggerDisplay("SimpleInjectorInitializer: {RegisteredFactories}")]
Defined in
Namespace: Splat.SimpleInjector Assembly: Splat.SimpleInjector.dll Full name: Splat.SimpleInjector.SimpleInjectorInitializer Modifiers: public
Summary¶
View source (opens in a new tab)
Provides a simple dependency resolver implementation using a factory-based registration model compatible with Simple
Injector patterns.
Applies to
net11.0, net10.0, net47, net471, net472, net48, net481
Class hierarchy
classDiagram
class SimpleInjectorInitializer
class IDependencyResolver {
<<interface>>
}
IDependencyResolver <|.. SimpleInjectorInitializer
class IReadonlyDependencyResolver {
<<interface>>
}
IReadonlyDependencyResolver <|.. SimpleInjectorInitializer
class IMutableDependencyResolver {
<<interface>>
}
IMutableDependencyResolver <|.. SimpleInjectorInitializer
class IDisposable {
<<interface>>
}
IDisposable <|.. SimpleInjectorInitializer
Implements: IDependencyResolver, IReadonlyDependencyResolver, IMutableDependencyResolver, IDisposable (opens in a new tab)
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¶
| Name | Summary |
|---|---|
| .ctor |
Properties¶
| Name | Summary |
|---|---|
| RegisteredFactories | Gets dictionary of registered factories. |
Methods¶
| Name | Summary |
|---|---|
| GetService | Gets an instance of the given serviceType. Must return null if the service is not available (must not throw). |
| GetServices | Gets all instances of the given serviceType. Must return an empty collection if the service is not available (must not return null or throw). |
| HasRegistration | Determines whether a registration exists for the specified service type. |
| Register | Registers a factory method for creating instances of the specified service type. |
| UnregisterCurrent | Unregisters the current instance of the specified service type from the context. |
| UnregisterAll | Unregisters all service registrations for the specified service type. |
| ServiceRegistrationCallback | Registers a callback to be invoked when a service of the specified type is registered or becomes available. |
| RegisterConstant | Registers a constant value of the specified reference type for later retrieval or use. |
| RegisterLazySingleton | Registers a singleton service of type T that is created lazily using the specified factory function. |
| Dispose | Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. |
Inherited members
System.Object.Equals(System.Object)(opens in a new tab)System.Object.Equals(System.Object,System.Object)(opens in a new tab)System.Object.GetHashCode(opens in a new tab)System.Object.GetType(opens in a new tab)System.Object.MemberwiseClone(opens in a new tab)System.Object.ReferenceEquals(System.Object,System.Object)(opens in a new tab)System.Object.ToString(opens in a new tab)