Class KernelBase
The base implementation of an IKernel.
Inherited Members
Namespace: Telerik.JustMock.AutoMock.Ninject
Assembly: Telerik.JustMock.dll
Syntax
public abstract class KernelBase : BindingRoot, IKernel, IBindingRoot, IResolutionRoot, IFluentSyntax, IServiceProvider, INotifyWhenDisposed, IDisposableObject, IDisposable
Constructors
KernelBase()
KernelBase(IComponentContainer, INinjectSettings, INinjectModule[])
Initializes a new instance of the KernelBase class.
Declaration
protected KernelBase(IComponentContainer components, INinjectSettings settings, params INinjectModule[] modules)
Parameters
IComponentContainer
components
The component container to use. |
INinjectSettings
settings
The configuration to use. |
INinjectModule[]
modules
The modules to load into the kernel. |
KernelBase(INinjectSettings, INinjectModule[])
Initializes a new instance of the KernelBase class.
Declaration
protected KernelBase(INinjectSettings settings, params INinjectModule[] modules)
Parameters
INinjectSettings
settings
The configuration to use. |
INinjectModule[]
modules
The modules to load into the kernel. |
KernelBase(INinjectModule[])
Initializes a new instance of the KernelBase class.
Declaration
protected KernelBase(params INinjectModule[] modules)
Parameters
INinjectModule[]
modules
The modules to load into the kernel. |
Properties
Components
Gets the component container, which holds components that contribute to Ninject.
Declaration
public IComponentContainer Components { get; }
Property Value
IComponentContainer
|
Implements
Settings
Gets the kernel settings.
Declaration
public INinjectSettings Settings { get; }
Property Value
INinjectSettings
|
Implements
Methods
AddBinding(IBinding)
Registers the specified binding.
Declaration
public override void AddBinding(IBinding binding)
Parameters
IBinding
binding
The binding to add. |
Overrides
Implements
AddComponents()
Adds components to the kernel during startup.
Declaration
protected abstract void AddComponents()
BeginBlock()
Begins a new activation block, which can be used to deterministically dispose resolved instances.
Declaration
public virtual IActivationBlock BeginBlock()
Returns
IActivationBlock
The new activation block. |
Implements
CanResolve(IRequest)
Determines whether the specified request can be resolved.
Declaration
public virtual bool CanResolve(IRequest request)
Parameters
IRequest
request
The request. |
Returns
System.Boolean
|
Implements
CanResolve(IRequest, Boolean)
Determines whether the specified request can be resolved.
Declaration
public virtual bool CanResolve(IRequest request, bool ignoreImplicitBindings)
Parameters
IRequest
request
The request. |
System.Boolean
ignoreImplicitBindings
if set to |
Returns
System.Boolean
|
Implements
CreateContext(IRequest, IBinding)
Creates a context for the specified request and binding.
Declaration
protected virtual IContext CreateContext(IRequest request, IBinding binding)
Parameters
IRequest
request
The request. |
IBinding
binding
The binding. |
Returns
IContext
The created context. |
CreateRequest(Type, Func<IBindingMetadata, Boolean>, IEnumerable<IParameter>, Boolean, Boolean)
Creates a request for the specified service.
Declaration
public virtual IRequest CreateRequest(Type service, Func<IBindingMetadata, bool> constraint, IEnumerable<IParameter> parameters, bool isOptional, bool isUnique)
Parameters
System.Type
service
The service that is being requested. |
System.Func<IBindingMetadata, System.Boolean>
constraint
The constraint to apply to the bindings to determine if they match the request. |
System.Collections.Generic.IEnumerable<IParameter>
parameters
The parameters to pass to the resolution. |
System.Boolean
isOptional
|
System.Boolean
isUnique
|
Returns
IRequest
The created request. |
Implements
Dispose(Boolean)
Releases resources held by the object.
Declaration
public override void Dispose(bool disposing)
Parameters
System.Boolean
disposing
|
Overrides
GetBindings(Type)
Gets the bindings registered for the specified service.
Declaration
public virtual IEnumerable<IBinding> GetBindings(Type service)
Parameters
System.Type
service
The service in question. |
Returns
System.Collections.Generic.IEnumerable<IBinding>
A series of bindings that are registered for the service. |
Implements
GetModules()
Gets the modules that have been loaded into the kernel.
Declaration
public IEnumerable<INinjectModule> GetModules()
Returns
System.Collections.Generic.IEnumerable<INinjectModule>
A series of loaded modules. |
Implements
HandleMissingBinding(IRequest)
Attempts to handle a missing binding for a request.
Declaration
protected virtual bool HandleMissingBinding(IRequest request)
Parameters
IRequest
request
The request. |
Returns
System.Boolean
|
HasModule(String)
Determines whether a module with the specified name has been loaded in the kernel.
Declaration
public bool HasModule(string name)
Parameters
System.String
name
The name of the module. |
Returns
System.Boolean
|
Implements
Inject(Object, IParameter[])
Injects the specified existing instance, without managing its lifecycle.
Declaration
public virtual void Inject(object instance, params IParameter[] parameters)
Parameters
System.Object
instance
The instance to inject. |
IParameter[]
parameters
The parameters to pass to the request. |
Implements
Load(IEnumerable<Assembly>)
Loads modules defined in the specified assemblies.
Declaration
public void Load(IEnumerable<Assembly> assemblies)
Parameters
System.Collections.Generic.IEnumerable<System.Reflection.Assembly>
assemblies
The assemblies to search. |
Implements
Load(IEnumerable<String>)
Loads modules from the files that match the specified pattern(s).
Declaration
public void Load(IEnumerable<string> filePatterns)
Parameters
System.Collections.Generic.IEnumerable<System.String>
filePatterns
The file patterns (i.e. ".dll", "modules/.rb") to match. |
Implements
Load(IEnumerable<INinjectModule>)
Loads the module(s) into the kernel.
Declaration
public void Load(IEnumerable<INinjectModule> m)
Parameters
System.Collections.Generic.IEnumerable<INinjectModule>
m
The modules to load. |
Implements
Release(Object)
Deactivates and releases the specified instance if it is currently managed by Ninject.
Declaration
public virtual bool Release(object instance)
Parameters
System.Object
instance
The instance to release. |
Returns
System.Boolean
langword_csharp_True if the instance was found and released; otherwise false. |
Implements
RemoveBinding(IBinding)
Unregisters the specified binding.
Declaration
public override void RemoveBinding(IBinding binding)
Parameters
IBinding
binding
The binding to remove. |
Overrides
Implements
Resolve(IRequest)
Resolves instances for the specified request. The instances are not actually resolved until a consumer iterates over the enumerator.
Declaration
public virtual IEnumerable<object> Resolve(IRequest request)
Parameters
IRequest
request
The request to resolve. |
Returns
System.Collections.Generic.IEnumerable<System.Object>
An enumerator of instances that match the request. |
Implements
SatifiesRequest(IRequest)
Returns a predicate that can determine if a given IBinding matches the request.
Declaration
protected virtual Func<IBinding, bool> SatifiesRequest(IRequest request)
Parameters
IRequest
request
The request/ |
Returns
System.Func<IBinding, System.Boolean>
A predicate that can determine if a given IBinding matches the request. |
Unbind(Type)
Unregisters all bindings for the specified service.
Declaration
public override void Unbind(Type service)
Parameters
System.Type
service
The service to unbind. |
Overrides
Implements
Unload(String)
Unloads the plugin with the specified name.
Declaration
public void Unload(string name)
Parameters
System.String
name
The plugin's name. |
Implements
Explicit Interface Implementations
IServiceProvider.GetService(Type)
Gets the service object of the specified type.
Declaration
object IServiceProvider.GetService(Type service)
Parameters
System.Type
service
The service type. |
Returns
System.Object
The service object |