C# Class Castle.Facilities.TypedFactory.DefaultTypedFactoryComponentSelector

Inheritance: ITypedFactoryComponentSelector
Show file Open project: castleproject/Windsor

Public Methods

Method Description
DefaultTypedFactoryComponentSelector ( bool getMethodsResolveByName = true, bool fallbackToResolveByTypeIfNameNotFound = false ) : System
SelectComponent ( MethodInfo method, Type type, object arguments ) : Func

Protected Methods

Method Description
BuildFactoryComponent ( MethodInfo method, string componentName, Type componentType, IDictionary additionalArguments ) : Func

Builds TypedFactoryComponentResolver for given call. By default if componentType is a collection returns factory calling IKernel.ResolveAll(System.Type) on collection's item type, otherwise standard TypedFactoryComponentResolver.

DefaultTypedFactoryComponentSelector ( ) : System
GetArguments ( MethodInfo method, object arguments ) : IDictionary

Selects arguments to be passed to resolution pipeline. By default passes all given arguments keyed by names of their corresponding method parameters.

GetComponentName ( MethodInfo method, object arguments ) : string

Selects name of the component to resolve. If method Name is GetFoo returns "Foo", otherwise null.

GetComponentType ( MethodInfo method, object arguments ) : Type

Selects type of the component to resolve. Uses method return type.

Method Details

BuildFactoryComponent() protected method

Builds TypedFactoryComponentResolver for given call. By default if componentType is a collection returns factory calling IKernel.ResolveAll(System.Type) on collection's item type, otherwise standard TypedFactoryComponentResolver.
protected BuildFactoryComponent ( MethodInfo method, string componentName, Type componentType, IDictionary additionalArguments ) : Func
method System.Reflection.MethodInfo
componentName string
componentType System.Type
additionalArguments IDictionary
return Func

DefaultTypedFactoryComponentSelector() protected method

protected DefaultTypedFactoryComponentSelector ( ) : System
return System

DefaultTypedFactoryComponentSelector() public method

public DefaultTypedFactoryComponentSelector ( bool getMethodsResolveByName = true, bool fallbackToResolveByTypeIfNameNotFound = false ) : System
getMethodsResolveByName bool If set to true, all methods with names like 'GetSomething' will try to resolve by name component 'something'. Defaults to true.
fallbackToResolveByTypeIfNameNotFound bool If set to true, will fallback to resolving by type, if can not find component with specified name. This property is here for backward compatibility. It is recommended not to use it. Defaults to false.
return System

GetArguments() protected method

Selects arguments to be passed to resolution pipeline. By default passes all given arguments keyed by names of their corresponding method parameters.
protected GetArguments ( MethodInfo method, object arguments ) : IDictionary
method System.Reflection.MethodInfo
arguments object
return IDictionary

GetComponentName() protected method

Selects name of the component to resolve. If method Name is GetFoo returns "Foo", otherwise null.
protected GetComponentName ( MethodInfo method, object arguments ) : string
method System.Reflection.MethodInfo
arguments object
return string

GetComponentType() protected method

Selects type of the component to resolve. Uses method return type.
protected GetComponentType ( MethodInfo method, object arguments ) : Type
method System.Reflection.MethodInfo
arguments object
return System.Type

SelectComponent() public method

public SelectComponent ( MethodInfo method, Type type, object arguments ) : Func
method System.Reflection.MethodInfo
type System.Type
arguments object
return Func