Skip to content

NinjectDependencyResolver class

Defined in

Namespace: Splat.Ninject Assembly: Splat.Ninject.dll Full name: Splat.Ninject.NinjectDependencyResolver Modifiers: public

Summary

View source

        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, net10.0-desktop1.0, net10.0-browserwasm1.0, net9.0, net9.0, net9.0-browserwasm1.0, net9.0-desktop1.0, net8.0, net8.0, net8.0-ios17.5, net8.0-macos14.5, net8.0-macos14.5, net8.0-macos14.2, net8.0-macos14.2, net8.0-maccatalyst17.5, net8.0-maccatalyst17.5, net8.0-ios17.5, net8.0-tvos17.2, net8.0-tvos17.2, netstandard2.1, netstandard2.1, netstandard2.0, netstandard2.0, net471, net481, net462

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

NameSummary
.ctorProvides an implementation of the IDependencyResolver interface using the Ninject IoC container. Enables registration, resolution, and management of service dependencies within an...

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