C# Class Ninject.KernelBase

Inheritance: BindingRoot, IKernel
Show file Open project: ninject/Ninject Class Usage Examples

Private Properties

Property Type Description

Public Methods

Method Description
AddBinding ( IBinding binding ) : void

Registers the specified binding.

BeginBlock ( ) : IActivationBlock

Begins a new activation block, which can be used to deterministically dispose resolved instances.

BuildReadonlyKernel ( ) : IReadOnlyKernel
CanResolve ( IRequest request ) : bool

Determines whether the specified request can be resolved.

CanResolve ( IRequest request, bool ignoreImplicitBindings ) : bool

Determines whether the specified request can be resolved.

CreateRequest ( Type service, bool>.Func constraint, IEnumerable parameters, bool isOptional, bool isUnique ) : IRequest

Creates a request for the specified service.

Dispose ( bool disposing ) : void

Releases resources held by the object.

GetBindings ( Type service ) : IEnumerable

Gets the bindings registered for the specified service.

GetModules ( ) : IEnumerable

Gets the modules that have been loaded into the kernel.

GetService ( Type serviceType ) : object
HasModule ( string name ) : bool

Determines whether a module with the specified name has been loaded in the kernel.

Inject ( object instance ) : void

Injects the specified existing instance, without managing its lifecycle.

Load ( IEnumerable assemblies ) : void

Loads modules defined in the specified assemblies.

Load ( IEnumerable m ) : void

Loads the module(s) into the kernel.

Load ( IEnumerable filePatterns ) : void

Loads modules from the files that match the specified pattern(s).

Release ( object instance ) : bool

Deactivates and releases the specified instance if it is currently managed by Ninject.

RemoveBinding ( IBinding binding ) : void

Unregisters the specified binding.

Resolve ( IRequest request ) : IEnumerable

Resolves instances for the specified request. The instances are not actually resolved until a consumer iterates over the enumerator.

Unbind ( Type service ) : void

Unregisters all bindings for the specified service.

Unload ( string name ) : void

Unloads the plugin with the specified name.

Protected Methods

Method Description
KernelBase ( ) : System

Initializes a new instance of the KernelBase class.

KernelBase ( IComponentContainer components, INinjectSettings settings ) : System

Initializes a new instance of the KernelBase class.

KernelBase ( INinjectSettings settings ) : System

Initializes a new instance of the KernelBase class.

Method Details

AddBinding() public method

Registers the specified binding.
public AddBinding ( IBinding binding ) : void
binding IBinding The binding to add.
return void

BeginBlock() public method

Begins a new activation block, which can be used to deterministically dispose resolved instances.
public BeginBlock ( ) : IActivationBlock
return IActivationBlock

BuildReadonlyKernel() public method

public BuildReadonlyKernel ( ) : IReadOnlyKernel
return IReadOnlyKernel

CanResolve() public method

Determines whether the specified request can be resolved.
public CanResolve ( IRequest request ) : bool
request IRequest The request.
return bool

CanResolve() public method

Determines whether the specified request can be resolved.
public CanResolve ( IRequest request, bool ignoreImplicitBindings ) : bool
request IRequest The request.
ignoreImplicitBindings bool if set to true implicit bindings are ignored.
return bool

CreateRequest() public method

Creates a request for the specified service.
public CreateRequest ( Type service, bool>.Func constraint, IEnumerable parameters, bool isOptional, bool isUnique ) : IRequest
service System.Type The service that is being requested.
constraint bool>.Func The constraint to apply to the bindings to determine if they match the request.
parameters IEnumerable The parameters to pass to the resolution.
isOptional bool True if the request is optional; otherwise, false.
isUnique bool True if the request should return a unique result; otherwise, false.
return IRequest

Dispose() public method

Releases resources held by the object.
public Dispose ( bool disposing ) : void
disposing bool True if called manually, otherwise by GC.
return void

GetBindings() public method

Gets the bindings registered for the specified service.
public GetBindings ( Type service ) : IEnumerable
service System.Type The service in question.
return IEnumerable

GetModules() public method

Gets the modules that have been loaded into the kernel.
public GetModules ( ) : IEnumerable
return IEnumerable

GetService() public method

public GetService ( Type serviceType ) : object
serviceType System.Type
return object

HasModule() public method

Determines whether a module with the specified name has been loaded in the kernel.
public HasModule ( string name ) : bool
name string The name of the module.
return bool

Inject() public method

Injects the specified existing instance, without managing its lifecycle.
public Inject ( object instance ) : void
instance object The instance to inject.
return void

KernelBase() protected method

Initializes a new instance of the KernelBase class.
protected KernelBase ( ) : System
return System

KernelBase() protected method

Initializes a new instance of the KernelBase class.
protected KernelBase ( IComponentContainer components, INinjectSettings settings ) : System
components IComponentContainer The component container to use.
settings INinjectSettings The configuration to use.
return System

KernelBase() protected method

Initializes a new instance of the KernelBase class.
protected KernelBase ( INinjectSettings settings ) : System
settings INinjectSettings The configuration to use.
return System

Load() public method

Loads modules defined in the specified assemblies.
public Load ( IEnumerable assemblies ) : void
assemblies IEnumerable The assemblies to search.
return void

Load() public method

Loads the module(s) into the kernel.
public Load ( IEnumerable m ) : void
m IEnumerable The modules to load.
return void

Load() public method

Loads modules from the files that match the specified pattern(s).
public Load ( IEnumerable filePatterns ) : void
filePatterns IEnumerable The file patterns (i.e. "*.dll", "modules/*.rb") to match.
return void

Release() public method

Deactivates and releases the specified instance if it is currently managed by Ninject.
public Release ( object instance ) : bool
instance object The instance to release.
return bool

RemoveBinding() public method

Unregisters the specified binding.
public RemoveBinding ( IBinding binding ) : void
binding IBinding The binding to remove.
return void

Resolve() public method

Resolves instances for the specified request. The instances are not actually resolved until a consumer iterates over the enumerator.
public Resolve ( IRequest request ) : IEnumerable
request IRequest The request to resolve.
return IEnumerable

Unbind() public method

Unregisters all bindings for the specified service.
public Unbind ( Type service ) : void
service System.Type The service to unbind.
return void

Unload() public method

Unloads the plugin with the specified name.
public Unload ( string name ) : void
name string The plugin's name.
return void