<PackageReference Include="Castle.Windsor" Version="5.0.1" />

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 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.

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

public ComponentRegistration(Type[] services)

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

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

Set a custom IComponentActivator which creates and destroys the component.

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

Adds the attribute 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> DependsOn(Dependency dependency)

Defines additional dependencies for the component. Those can be any of ServiceOverride, Property and Parameter. Use the static methods on Dependency class to define the dependencies. See the example attached.

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

Defines additional dependencies for the component. Those can be any combibation of ServiceOverride, Property and Parameter. Use the static methods on Dependency class to define the dependencies. See the example attached.

public ComponentRegistration<TService> DependsOn(Arguments dependencies)

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

public ComponentRegistration<TService> DependsOn(IDictionary dependencies)

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

public ComponentRegistration<TService> DependsOn(object dependenciesAsAnonymousType)

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

Allows custom dependencies to by defined dyncamically. Calling this overload is synonymous to using DynamicParameters

Allows custom dependencies to by defined dynamically with releasing capability. Calling this overload is synonymous to using DynamicParameters

Allows custom dependencies to by defined dynamically with releasing capability. Calling this overload is synonymous to using DynamicParameters

Allows custom dependencies to by defined dynamically.

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.

Sets ExtendedProperties for this component.

public ComponentRegistration<TService> ExtendedProperties(object anonymous)

Sets ExtendedProperties for this component.

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

Adds types as additional services to be exposed by this component.

public ComponentRegistration<TService> Forward<TService2>()

Adds TService2 as additional service to be exposed by this component.

public ComponentRegistration<TService> Forward<TService2, TService3>()

Adds TService2 and TService3 as additional services to be exposed by this component.

public ComponentRegistration<TService> Forward<TService2, TService3, TService4>()

Adds TService2 , TService3 and TService4 as additional services to be exposed by this component.

public ComponentRegistration<TService> Forward<TService2, TService3, TService4, TService5>()

Adds TService2 , TService3 , TService4 and TService5 as additional services to be exposed by this component.

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

Adds types as additional services to be exposed by this component.

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

Sets the concrete type that implements the service to TImpl .

If not set, the class service type or first registered interface 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 class service type or first registered interface will be used as the implementation for this component.

public ComponentRegistration<TService> ImplementedBy(Type type, IGenericImplementationMatchingStrategy genericImplementationMatchingStrategy)

Sets the concrete type that implements the service to type .

If not set, the class service type or first registered interface will be used as the implementation for this component.

public ComponentRegistration<TService> ImplementedBy(Type type, IGenericServiceStrategy genericServiceStrategy)

Sets the concrete type that implements the service to type .

If not set, the class service type or first registered interface will be used as the implementation for this component.

public ComponentRegistration<TService> ImplementedBy(Type type, IGenericImplementationMatchingStrategy genericImplementationMatchingStrategy, IGenericServiceStrategy genericServiceStrategy)

Sets the concrete type that implements the service to type .

If not set, the class service type or first registered interface 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> IsDefault(Predicate<Type> serviceFilter)

Overrides default behavior by making the current component the default for every service it exposes. The serviceFilter allows user to narrow down the number of services which should be make defaults.

public ComponentRegistration<TService> IsDefault()

Overrides default behavior by making the current component the default for every service it exposes.

public ComponentRegistration<TService> IsFallback(Predicate<Type> serviceFilter)

Overrides default behavior by making the current component the fallback for every service it exposes that serviceFilter returns true for. That is if another, non-fallback, component will be registered exposing any of these same services as this component, that other component will take precedence over this one, regardless of order in which they are registered.

public ComponentRegistration<TService> IsFallback()

Overrides default behavior by making the current component the fallback for every service it exposes. That is if another, non-fallback, component will be registered exposing any of the same services as this component, that other component will take precedence over this one, regardless of order in which they are registered

public ComponentRegistration<TService> LifestyleBoundTo<TBaseForRoot>()

Sets component lifestyle to scoped per farthest component on the resolution stack where implementation type is assignable to TBaseForRoot .

public ComponentRegistration<TService> LifestyleBoundTo(Func<IHandler[], IHandler> scopeRootBinder)

Sets component lifestyle to scoped per scope determined by scopeRootBinder

public ComponentRegistration<TService> LifestyleBoundToNearest<TBaseForRoot>()

Sets component lifestyle to scoped per nearest component on the resolution stack where implementation type is assignable to TBaseForRoot .

public ComponentRegistration<TService> LifestyleCustom(Type customLifestyleType)

Sets component lifestyle to specified one.

public ComponentRegistration<TService> LifestyleCustom<TLifestyleManager>() where TLifestyleManager : ILifestyleManager

Sets component lifestyle to specified one.

Sets component lifestyle to per thread.

public ComponentRegistration<TService> LifestylePooled(int? initialSize = default, int? maxSize = default)

Sets component lifestyle to pooled. If initialSize or maxSize are not set default values will be used.

public ComponentRegistration<TService> LifestyleScoped(Type scopeAccessorType = null)

Sets component lifestyle to scoped per explicit scope. If scopeAccessorType is provided, it will be used to access scope for the component. Otherwise the default scope accessor will be used.

public ComponentRegistration<TService> LifestyleScoped<TScopeAccessor>() where TScopeAccessor : IScopeAccessor

Sets component lifestyle to scoped per explicit scope.

Sets component lifestyle to singleton.

Sets component lifestyle to transient.

public ComponentRegistration<TService> Named(string name)

Set a name of this registration. This is required if you have multiple components for a given service and want to be able to resolve some specific ones. Then you'd provide the name so that Windsor knows which one of the bunch you know. Otherwise don't bother setting the name.

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

public ComponentRegistration<TService> NamedAutomatically(string name)

This method as opposed to Named should be used by tools like facilities when the name is not provided by the user, but autogenerated and user has no interest in seing this name, for example in diagnostics reports. Set a name of this registration. This is required if you have multiple components for a given service and want to be able to resolve some specific ones. Then you'd provide the name so that Windsor knows which one of the bunch you know. Otherwise don't bother setting the name.

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

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

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

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

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

public ComponentRegistration<TService> OnDestroy(Action<TService>[] actions)

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

public ComponentRegistration<TService> OnDestroy(LifecycleActionDelegate<TService>[] actions)

Stores a set of LifecycleActionDelegate<T> which will be invoked when the component is destroyed which means when it's released or it's lifetime scope ends. Notice that usage of this method will cause instsances of the component to be tracked, even if they wouldn't be otherwise.

Services that are already present in the container will be skipped. If no new service is left the registration will not happen at all.

public ComponentRegistration<TService> OverWrite()

With the overwrite.

Filters (settable) properties of the component's implementation type to expose in the container and specifies if matched properties are considered mandatory.

public ComponentRegistration<TService> PropertiesIgnore(Func<PropertyInfo, bool> propertySelector)

Filters (settable) properties of the component's implementation type to ignore.

public ComponentRegistration<TService> PropertiesIgnore(Func<ComponentModel, PropertyInfo, bool> propertySelector)

Filters (settable) properties of the component's implementation type to ignore.

public ComponentRegistration<TService> PropertiesRequire(Func<PropertyInfo, bool> propertySelector)

Filters (settable) properties of the component's implementation type to expose in the container as mandatory dependencies

public ComponentRegistration<TService> PropertiesRequire(Func<ComponentModel, PropertyInfo, bool> propertySelector)

Filters (settable) properties of the component's implementation type to expose in the container as mandatory dependencies

Sets the interceptor selector for this component.

Sets the interceptor selector for this component.

public ComponentRegistration<TService> UsingFactory<TFactory, TServiceImpl>(Func<TFactory, TServiceImpl> factory) where TServiceImpl : TService

Uses a factory to instantiate the component

public ComponentRegistration<TService> UsingFactoryMethod<TImpl>(Func<TImpl> factoryMethod, bool managedExternally = false) where TImpl : TService

Uses a factory method to instantiate the component.

public ComponentRegistration<TService> UsingFactoryMethod<TImpl>(Func<IKernel, TImpl> factoryMethod, bool managedExternally = false) where TImpl : TService

Uses a factory method to instantiate the component.

public ComponentRegistration<TService> UsingFactoryMethod<TImpl>(Func<IKernel, ComponentModel, CreationContext, TImpl> factoryMethod, bool managedExternally = false) 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.