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

AbstractHandler

Implements the basis of IHandler

Lifestyle manager instance

Gets the component model.

public HandlerState CurrentState { get; }

Gets the handler state.

protected IDictionary<string, DependencyModel> DependenciesByKey { get; }

protected IKernelInternal Kernel { get; }

public Type Service { get; }

Constructs and initializes the handler

public void AddCustomDependencyValue(object key, object value)

protected void AddDependency(DependencyModel dependency)

Invoked by EnsureDependenciesCanBeSatisfied in order to check if a dependency can be satisfied. If not, the handler is set to a 'waiting dependency' state.

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

protected bool CanSatisfyConstructor(ConstructorCandidate constructor)

protected bool CanSatisfyDependency(DependencyModel dependency)

Creates an implementation of ILifestyleManager based on LifestyleType and invokes Init to initialize the newly created manager.

protected void DependencySatisfied(ref bool stateChanged)

Invoked by the kernel when one of registered dependencies were satisfied by new components registered.

public virtual void Dispose()

Checks if the handler is able to, at very least, satisfy the dependencies for the constructor with less parameters

public bool HasCustomParameter(object key)

public virtual void Init(IKernel kernel)

Saves the kernel instance, subscribes to AddedAsChildKernel event, creates the lifestyle manager instance and computes the handler state.

public string ObtainDependencyDetails(IList dependenciesChecked)

Returns human readable list of dependencies this handler is waiting for.

protected void OnAddedAsChildKernel(object sender, EventArgs e)

Invoked when the container receives a parent container reference.

public virtual bool Release(object instance)

disposes the component instance (or recycle it).

public abstract bool ReleaseCore(object instance)

Should be implemented by derived classes: disposes the component instance (or recycle it)

public void RemoveCustomDependencyValue(object key)

public object Resolve(CreationContext context)

Returns an instance of the component this handler is responsible for

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

protected virtual object Resolve(CreationContext context, bool instanceRequired)

Returns an instance of the component this handler is responsible for

protected abstract object ResolveCore(CreationContext context, bool requiresDecommission, bool instanceRequired)

Should be implemented by derived classes: returns an instance of the component this handler is responsible for

protected void SetNewState(HandlerState newState)

public object TryResolve(CreationContext context)