<PackageReference Include="castle.windsor" Version="2.5.2" />

ComponentRegistration<TService>

public class ComponentRegistration<TService> : IRegistration
Registration for a single type as a component with the kernel.

You can create a new registration with the Component factory.
public Type[] ForwardedTypes { get; }

Gets the forwarded service types on behalf of this component.

Add more types to forward using Forward.

public Type Implementation { get; }

The concrete type that implements the service.

To set the implementation, use ImplementedBy.

public LifestyleGroup<TService> LifeStyle { get; }

Set the lifestyle of this component. For example singleton and transient (also known as 'factory').

public string Name { get; }

The name of the component. Will become the key for the component in the kernel.

To set the name, use Named.

If not set, the FullName of the Implementation will be used as the key to register the component.

public ProxyGroup<TService> Proxy { get; }

Set proxy for this component.

public Type ServiceType { get; protected set; }

The type of the service, the same as TService.

This is the first type passed to For.

Initializes a new instance of the ComponentRegistration<T> class.

protected ComponentRegistration(ComponentModel componentModel)

Initializes a new instance of the ComponentRegistration<T> class with an existing ComponentModel.

public ComponentRegistration<TService> ActAs(object[] actors)

Marks the components with one or more actors.

public ComponentRegistration<TService> Activator<A>() where A : IComponentActivator

Set a custom IComponentActivator which creates and destroys the component.

public ComponentRegistration<TService> AddAttributeDescriptor(string key, string value)

Adds the attribute descriptor.

public ComponentRegistration<TService> AddDescriptor(ComponentDescriptor<TService> descriptor)

Adds the descriptor.

public AttributeKeyDescriptor<TService> Attribute(string key)

Creates an attribute descriptor.

public ComponentRegistration<TService> Configuration(Node[] configNodes)

Apply more complex configuration to this component registration.

public ComponentRegistration<TService> Configuration(IConfiguration configuration)

Apply more complex configuration to this component registration.

public ComponentRegistration<TService> CustomDependencies(Property[] dependencies)

Obsolete, use DependsOn instead.

public ComponentRegistration<TService> CustomDependencies(IDictionary dependencies)

Obsolete, use DependsOn instead.

public ComponentRegistration<TService> CustomDependencies(object dependencies)

Obsolete, use DependsOn instead.

public ComponentRegistration<TService> DependsOn(Property[] dependencies)

Specify custom dependencies using ForKey or ForKey.

You can pass ServiceOverrides to specify the components this component should be resolved with.

public ComponentRegistration<TService> DependsOn(IDictionary dependencies)

Uses a dictionary of key/value pairs, to specify custom dependencies.

Use ServiceOverrides to specify the components this component should be resolved with.

public ComponentRegistration<TService> DependsOn(object anonymous)

Uses an (anonymous) object as a dictionary, to specify custom dependencies.

Use ServiceOverrides to specify the components this component should be resolved with.

Allows custom dependencies to by defined dyncamically.

Allows custom dependencies to by defined dynamically with releasing capability.

Allows custom dependencies to by defined dynamically with releasing capability.

public ComponentRegistration<TService> ExtendedProperties(Property[] properties)

Sets ExtendedProperties for this component.

public ComponentRegistration<TService> ExtendedProperties(object anonymous)

Sets ExtendedProperties for this component.

public ComponentRegistration<TService> Forward(Type[] types)

Registers the service types on behalf of this component.

public ComponentRegistration<TService> Forward<TSecondService>()

Registers the service types on behalf of this component.

public ComponentRegistration<TService> Forward<TSecondService, TThirdService>()

Registers the service types on behalf of this component.

public ComponentRegistration<TService> Forward<TSecondService, TThirdService, TFourthService>()

Registers the service types on behalf of this component.

public ComponentRegistration<TService> Forward<TSecondService, TThirdService, TFourthService, TFifthService>()

Registers the service types on behalf of this component.

public ComponentRegistration<TService> Forward(IEnumerable<Type> types)

Registers the service types on behalf of this component.

public ComponentRegistration<TService> If(ComponentFilter ifFilter)

Assigns a conditional predication which must be satisfied.

The component will only be registered into the kernel if this predicate is satisfied (or not assigned at all).

public ComponentRegistration<TService> ImplementedBy<TImpl>() where TImpl : TService

Sets the concrete type that implements the service to TImpl.

If not set, the ServiceType will be used as the implementation for this component.

public ComponentRegistration<TService> ImplementedBy(Type type)

Sets the concrete type that implements the service to type.

If not set, the ServiceType will be used as the implementation for this component.

public ComponentRegistration<TService> Instance(TService instance)

Assigns an existing instance as the component for this registration.

public InterceptorGroup<TService> Interceptors(InterceptorReference[] interceptors)

Set the interceptors for this component.

public ComponentRegistration<TService> Interceptors(Type[] interceptors)

Set the interceptors for this component.

public ComponentRegistration<TService> Interceptors<TInterceptor>() where TInterceptor : IInterceptor

Set the interceptor for this component.

public ComponentRegistration<TService> Interceptors<TInterceptor1, TInterceptor2>() where TInterceptor1 : IInterceptor where TInterceptor2 : IInterceptor

Set the interceptor for this component.

public ComponentRegistration<TService> Interceptors(string[] keys)

Set the interceptor for this component.

public ComponentRegistration<TService> Named(string name)

Change the name of this registration. This will be the key for the component in the kernel.

If not set, the FullName of the Implementation will be used as the key to register the component.

public ComponentRegistration<TService> OnCreate(OnCreateActionDelegate<TService>[] actions)

Stores a set of OnCreateActionDelegate<T> which will be invoked when the component is created and before it's returned from the container.

public ComponentRegistration<TService> OverWrite()

With the overwrite.

public ComponentRegistration<TService> Parameters(Parameter[] parameters)

Set configuration parameters with string or IConfiguration values.

public ComponentRegistration<TService> SelectInterceptorsWith(IInterceptorSelector selector)

Sets the interceptor selector for this component.

public ComponentRegistration<TService> SelectInterceptorsWith(Action<ItemRegistration<IInterceptorSelector>> selector)

Sets the interceptor selector for this component.

Override (some of) the services that this component needs. Use ForKey to create an override.

Each key represents the service dependency of this component, for example the name of a constructor argument or a property. The corresponding value is the key of an other component registered to the kernel, and is used to resolve the dependency.

To specify dependencies which are not services, use DependsOn

Override (some of) the services that this component needs, using a dictionary.

Each key represents the service dependency of this component, for example the name of a constructor argument or a property. The corresponding value is the key of an other component registered to the kernel, and is used to resolve the dependency.

To specify dependencies which are not services, use DependsOn

public ComponentRegistration<TService> ServiceOverrides(object anonymous)

Override (some of) the services that this component needs, using an (anonymous) object as a dictionary.

Each key represents the service dependency of this component, for example the name of a constructor argument or a property. The corresponding value is the key of an other component registered to the kernel, and is used to resolve the dependency.

To specify dependencies which are not services, use DependsOn

public ComponentRegistration<TService> Unless(ComponentFilter unlessFilter)

Assigns a conditional predication which must not be satisfied.

The component will only be registered into the kernel if this predicate is not satisfied (or not assigned at all).

public ComponentRegistration<TService> UsingFactory<U, V>(Converter<U, V> factory) where V : TService

Uses a factory to instantiate the component

public ComponentRegistration<TService> UsingFactoryMethod<TImpl>(Func<TImpl> factoryMethod) where TImpl : TService

Uses a factory method to instantiate the component.

public ComponentRegistration<TService> UsingFactoryMethod<TImpl>(Converter<IKernel, TImpl> factoryMethod) where TImpl : TService

Uses a factory method to instantiate the component.

public ComponentRegistration<TService> UsingFactoryMethod<TImpl>(Func<IKernel, ComponentModel, CreationContext, TImpl> factoryMethod) where TImpl : TService

Uses a factory method to instantiate the component.

public ComponentRegistration<TService> UsingFactoryMethod<TImpl>(Func<IKernel, CreationContext, TImpl> factoryMethod) where TImpl : TService

Uses a factory method to instantiate the component.