C# Class Castle.MicroKernel.Resolvers.DefaultDependencyResolver

Inheritance: IDependencyResolver
Afficher le fichier Open project: 7digital/Castle.Windsor

Méthodes publiques

Méthode Description
AddSubResolver ( ISubDependencyResolver subResolver ) : void

Registers a sub resolver instance

CanResolve ( CreationContext context, ISubDependencyResolver contextHandlerResolver, ComponentModel model, DependencyModel dependency ) : bool

Returns true if the resolver is able to satisfy the specified dependency.

Initialize ( IKernel kernel, DependencyDelegate dependencyDelegate ) : void

Initializes this instance with the specified dependency delegate.

RemoveSubResolver ( ISubDependencyResolver subResolver ) : void

Unregisters a sub resolver instance previously registered

Resolve ( CreationContext context, ISubDependencyResolver contextHandlerResolver, ComponentModel model, DependencyModel dependency ) : object

Try to resolve the dependency by checking the parameters in the model or checking the Kernel for the requested service.

The dependency resolver has the following precedence order: The dependency is checked within the CreationContext The dependency is checked within the IHandler instance for the component The dependency is checked within the registered ISubDependencyResolver s Finally the resolver tries the normal flow which is using the configuration or other component to satisfy the dependency

Méthodes protégées

Méthode Description
CanResolveParameterDependency ( ComponentModel model, DependencyModel dependency ) : bool
CanResolveServiceDependency ( CreationContext context, ComponentModel model, DependencyModel dependency ) : bool
ExtractComponentKey ( String keyValue, String name ) : String

Extracts the component name from the a ref strings which is ${something}

ObtainParameterModelMatchingDependency ( DependencyModel dependency, ComponentModel model ) : ParameterModel
RebuildContextForParameter ( CreationContext current, Type parameterType ) : CreationContext

This method rebuild the context for the parameter type. Naive implementation.

ResolveParameterDependency ( CreationContext context, ComponentModel model, DependencyModel dependency ) : object
ResolveServiceDependency ( CreationContext context, ComponentModel model, DependencyModel dependency ) : object

Private Methods

Méthode Description
GetParameterModelByType ( Type type, ComponentModel model ) : ParameterModel
HasComponentInValidState ( CreationContext context, Type service ) : bool
HasComponentInValidState ( string key ) : bool
IsHandlerInValidState ( IHandler handler ) : bool
ObtainParameterModelByKey ( DependencyModel dependency, ComponentModel model ) : ParameterModel
ObtainParameterModelByType ( DependencyModel dependency, ComponentModel model ) : ParameterModel
RaiseDependencyResolving ( ComponentModel model, DependencyModel dependency, object value ) : void
TryGetHandlerFromKernel ( DependencyModel dependency, CreationContext context ) : IHandler

Method Details

AddSubResolver() public méthode

Registers a sub resolver instance
public AddSubResolver ( ISubDependencyResolver subResolver ) : void
subResolver ISubDependencyResolver The subresolver instance
Résultat void

CanResolve() public méthode

Returns true if the resolver is able to satisfy the specified dependency.
public CanResolve ( CreationContext context, ISubDependencyResolver contextHandlerResolver, ComponentModel model, DependencyModel dependency ) : bool
context Castle.MicroKernel.Context.CreationContext Creation context, which is a resolver itself
contextHandlerResolver ISubDependencyResolver Parent resolver
model Castle.Core.ComponentModel Model of the component that is requesting the dependency
dependency Castle.Core.DependencyModel The dependency model
Résultat bool

CanResolveParameterDependency() protected méthode

protected CanResolveParameterDependency ( ComponentModel model, DependencyModel dependency ) : bool
model Castle.Core.ComponentModel
dependency Castle.Core.DependencyModel
Résultat bool

CanResolveServiceDependency() protected méthode

protected CanResolveServiceDependency ( CreationContext context, ComponentModel model, DependencyModel dependency ) : bool
context Castle.MicroKernel.Context.CreationContext
model Castle.Core.ComponentModel
dependency Castle.Core.DependencyModel
Résultat bool

ExtractComponentKey() protected méthode

Extracts the component name from the a ref strings which is ${something}
protected ExtractComponentKey ( String keyValue, String name ) : String
keyValue String
name String
Résultat String

Initialize() public méthode

Initializes this instance with the specified dependency delegate.
public Initialize ( IKernel kernel, DependencyDelegate dependencyDelegate ) : void
kernel IKernel kernel
dependencyDelegate DependencyDelegate The dependency delegate.
Résultat void

ObtainParameterModelMatchingDependency() protected méthode

protected ObtainParameterModelMatchingDependency ( DependencyModel dependency, ComponentModel model ) : ParameterModel
dependency Castle.Core.DependencyModel
model Castle.Core.ComponentModel
Résultat Castle.Core.ParameterModel

RebuildContextForParameter() protected méthode

This method rebuild the context for the parameter type. Naive implementation.
protected RebuildContextForParameter ( CreationContext current, Type parameterType ) : CreationContext
current Castle.MicroKernel.Context.CreationContext
parameterType System.Type
Résultat Castle.MicroKernel.Context.CreationContext

RemoveSubResolver() public méthode

Unregisters a sub resolver instance previously registered
public RemoveSubResolver ( ISubDependencyResolver subResolver ) : void
subResolver ISubDependencyResolver The subresolver instance
Résultat void

Resolve() public méthode

Try to resolve the dependency by checking the parameters in the model or checking the Kernel for the requested service.
The dependency resolver has the following precedence order: The dependency is checked within the CreationContext The dependency is checked within the IHandler instance for the component The dependency is checked within the registered ISubDependencyResolver s Finally the resolver tries the normal flow which is using the configuration or other component to satisfy the dependency
public Resolve ( CreationContext context, ISubDependencyResolver contextHandlerResolver, ComponentModel model, DependencyModel dependency ) : object
context Castle.MicroKernel.Context.CreationContext Creation context, which is a resolver itself
contextHandlerResolver ISubDependencyResolver Parent resolver
model Castle.Core.ComponentModel Model of the component that is requesting the dependency
dependency Castle.Core.DependencyModel The dependency model
Résultat object

ResolveParameterDependency() protected méthode

protected ResolveParameterDependency ( CreationContext context, ComponentModel model, DependencyModel dependency ) : object
context Castle.MicroKernel.Context.CreationContext
model Castle.Core.ComponentModel
dependency Castle.Core.DependencyModel
Résultat object

ResolveServiceDependency() protected méthode

protected ResolveServiceDependency ( CreationContext context, ComponentModel model, DependencyModel dependency ) : object
context Castle.MicroKernel.Context.CreationContext
model Castle.Core.ComponentModel
dependency Castle.Core.DependencyModel
Résultat object