NinjectDependencyResolver class¶
Defined in
Namespace: Splat.Ninject
Assembly: Splat.Ninject.dll
Full name: Splat.Ninject.NinjectDependencyResolver
Modifiers: public
Summary¶
Provides an implementation of the IDependencyResolver interface using the Ninject IoC container. Enables
registration, resolution, and management of service dependencies within an application.
Applies to
net10.0, net9.0, net9.0, net8.0, net8.0, netstandard2.0, netstandard2.0, net462, net481
Class hierarchy
classDiagram
class NinjectDependencyResolver
class IDependencyResolver {
<>
}
IDependencyResolver <|.. NinjectDependencyResolver
class IReadonlyDependencyResolver {
<>
}
IReadonlyDependencyResolver <|.. NinjectDependencyResolver
class IMutableDependencyResolver {
<>
}
IMutableDependencyResolver <|.. NinjectDependencyResolver
class IDisposable {
<>
}
IDisposable <|.. NinjectDependencyResolver
Implements: IDependencyResolver, IReadonlyDependencyResolver, IMutableDependencyResolver, IDisposable
Remarks¶
This resolver integrates Ninject's binding and resolution capabilities with a standard dependency resolver interface, allowing for flexible service registration and retrieval. Thread safety is ensured for disposal operations, but individual service factories should be thread-safe if used in multi-threaded scenarios. Disposing the resolver will also dispose the underlying Ninject kernel, releasing all managed resources.
Constructors¶
| Name | Summary |
|---|---|
| .ctor | Provides an implementation of the IDependencyResolver interface using the Ninject IoC container. Enables registration, resolution, and management of service dependencies within an... |
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. |
| 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. |
| 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. |
| Dispose | Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. |