Home

Castle Stronghold

Table of contents

IKernel API Document

The IKernel interface exposes all the functionality the MicroKernel implements.

Quick Note

It allows you to register components and request them by the key or the service they implemented. It also allow you to register facilities and subsystem, thus augmenting the functionality exposed by the kernel alone to fits your needs.

Properties

NameTypeDescription
ItemObject Returns the component instance by the key
ItemObject Returns the component instance by the service type
ComponentModelBuilderIComponentModelBuilder Returns the implementation of Castle.MicroKernel.IComponentModelBuilder
HandlerFactoryIHandlerFactory Returns the implementation of Castle.MicroKernel.IHandlerFactory
ConfigurationStoreIConfigurationStore Gets or sets the implementation of Castle.MicroKernel.IConfigurationStore
ReleasePolicyIReleasePolicy Gets or sets the implementation for Castle.MicroKernel.IReleasePolicy
ResolverIDependencyResolver Returns the implementation for Castle.MicroKernel.IDependencyResolver
ProxyFactoryIProxyFactory Gets or sets the implementation of Castle.MicroKernel.IProxyFactory allowing different strategies for proxy creation.
ParentIKernel Returns the parent kernel
GraphNodesGraphNode[] Graph of components and iteractions.

Methods

RemoveChildKernel(IKernel kernel)

Remove child kernel

ParameterDescription
kernel

AddChildKernel(IKernel kernel)

Support for kernel hierarchy

ParameterDescription
kernel

GetSubSystem(String key) : ISubSystem

Returns an implementation of Castle.MicroKernel.ISubSystem for the specified key.

ParameterDescription
key

AddSubSystem(String key, ISubSystem subsystem)

Adds (or replaces) an Castle.MicroKernel.ISubSystem

ParameterDescription
key
subsystem

GetFacilities() : IFacility[]

Returns the facilities registered on the kernel.

AddFacility(String key, IFacility facility)

Adds a Castle.MicroKernel.IFacility to the kernel.

ParameterDescription
key
facility

GetAssignableHandlers(Type service) : IHandler[]

Return handlers for components that implements the specified service. The check is made using IsAssignableFrom

ParameterDescription
service

GetHandlers(Type service) : IHandler[]

Return handlers for components that implements the specified service.

ParameterDescription
service

GetHandler(Type service) : IHandler

Returns the Castle.MicroKernel.IHandler for the specified service.

ParameterDescription
service

GetHandler(String key) : IHandler

Returns the Castle.MicroKernel.IHandler for the specified component key.

ParameterDescription
key

CreateComponentActivator(ComponentModel model) : IComponentActivator

Constructs an implementation of Castle.MicroKernel.IComponentActivator for the given Castle.Core.ComponentModel

ParameterDescription
model

ReleaseComponent(Object instance)

Releases a component instance. This allows the kernel to execute the proper decomission lifecycles on the component instance.

ParameterDescription
instance

RegisterCustomDependencies(String key, IDictionary dependencies)

Associates objects with a component handler, allowing it to use the specified dictionary when resolving dependencies

ParameterDescription
key
dependencies

RegisterCustomDependencies(Type service, IDictionary dependencies)

Associates objects with a component handler, allowing it to use the specified dictionary when resolving dependencies

ParameterDescription
service
dependencies

Resolve(String key, IDictionary arguments) : Object

Returns the component instance by the component key using dynamic arguments

ParameterDescription
key
arguments

Resolve(Type service, IDictionary arguments) : Object

Returns the component instance by the service type using dynamic arguments

ParameterDescription
service
arguments

HasComponent(Type service) : Boolean

Returns true if the specified service was registered

ParameterDescription
service

HasComponent(String key) : Boolean

Returns true if the specified key was registered

ParameterDescription
key

RemoveComponent(String key) : Boolean

Returns true if the specified component was found and could be removed (i.e. no other component depends on it)

ParameterDescription
key The component's key

AddComponentInstance(String key, Type serviceType, Object instance)

Used mostly by facilities. Adds an instance to be used as a component.

ParameterDescription
key
serviceType
instance

AddComponentInstance(String key, Object instance)

Used mostly by facilities. Adds an instance to be used as a component.

ParameterDescription
key
instance

AddCustomComponent(ComponentModel model)

Adds a custom made Castle.Core.ComponentModel. Used by facilities.

ParameterDescription
model

AddComponentWithExtendedProperties(String key, Type serviceType, Type classType, IDictionary extendedProperties)

Adds a concrete class and an interface as a component and specify the extended properties. Used by facilities, mostly.

ParameterDescription
key
serviceType
classType
extendedProperties

AddComponentWithExtendedProperties(String key, Type classType, IDictionary extendedProperties)

Adds a concrete class as a component and specify the extended properties. Used by facilities, mostly.

ParameterDescription
key
classType
extendedProperties

AddComponent(String key, Type serviceType, Type classType, LifestyleType lifestyle, Boolean overwriteLifestyle)

Adds a concrete class and an interface as a component with the specified lifestyle.

Quick Note

If you have indicated a lifestyle for the specified classType using attributes, this method will not overwrite that lifestyle. To do that, use the Castle.MicroKernel.IKernel.AddComponent(System.String,System.Type,System.Type,Castle.Core.LifestyleType,System.Boolean) method.

ParameterDescription
key The key with which to index the component.
serviceType The service System.Type that this component implements.
classType The System.Type of the component.
lifestyle The specified Castle.Core.LifestyleType for the component.
overwriteLifestyle If true, then ignores all other configurations for lifestyle and uses the value in the lifestyle parameter.

AddComponent(String key, Type serviceType, Type classType, LifestyleType lifestyle)

Adds a concrete class and an interface as a component with the specified lifestyle.

Quick Note

If you have indicated a lifestyle for the specified classType using attributes, this method will not overwrite that lifestyle. To do that, use the Castle.MicroKernel.IKernel.AddComponent(System.String,System.Type,System.Type,Castle.Core.LifestyleType,System.Boolean) method.

ParameterDescription
key The key with which to index the component.
serviceType The service System.Type that this component implements.
classType The System.Type of the component.
lifestyle The specified Castle.Core.LifestyleType for the component.

AddComponent(String key, Type serviceType, Type classType)

Adds a concrete class and an interface as a component

ParameterDescription
key The key with which to index the component.
serviceType The service System.Type that this component implements.
classType The System.Type of the component.

AddComponent(String key, Type classType, LifestyleType lifestyle, Boolean overwriteLifestyle)

Missing summary

ParameterDescription
key Missing documentation
classType Missing documentation
lifestyle Missing documentation
overwriteLifestyle Missing documentation

AddComponent(String key, Type classType, LifestyleType lifestyle)

Adds a concrete class as a component with the specified lifestyle.

Quick Note

If you have indicated a lifestyle for the specified classType using attributes, this method will not overwrite that lifestyle. To do that, use the Castle.MicroKernel.IKernel.AddComponent(System.String,System.Type,Castle.Core.LifestyleType,System.Boolean) method.

ParameterDescription
key The key with which to index the component.
classType The System.Type of the component.
lifestyle The specified Castle.Core.LifestyleType for the component.

AddComponent(String key, Type classType)

Adds a concrete class as a component

ParameterDescription
key
classType

Google
Search WWW Search castleproject.org