/// <summary> /// Initializes a new instance of the <see cref = "CreationContext" /> class. /// </summary> /// <param name = "requestedType">The type to extract generic arguments.</param> /// <param name = "parentContext">The parent context.</param> /// <param name = "propagateInlineDependencies">When set to <c>true</c> will clone <paramref name = "parentContext" /> <see /// cref = "AdditionalArguments" />.</param> public CreationContext(Type requestedType, CreationContext parentContext, bool propagateInlineDependencies) : this(parentContext.Handler, parentContext.ReleasePolicy, requestedType, null, null, parentContext) { if (parentContext == null) { throw new ArgumentNullException("parentContext"); } if (parentContext.extendedProperties != null) { extendedProperties = new Arguments(parentContext.extendedProperties); } if (propagateInlineDependencies && parentContext.HasAdditionalArguments) { additionalArguments = new Arguments(parentContext.additionalArguments); } }
/// <summary> /// Initializes a new instance of the <see cref = "CreationContext" /> class. /// </summary> /// <param name = "handler">The handler.</param> /// <param name = "releasePolicy">The release policy.</param> /// <param name = "requestedType">The type to extract generic arguments.</param> /// <param name = "additionalArguments">The additional arguments.</param> /// <param name = "converter">The conversion manager.</param> /// <param name = "parent">Parent context</param> public CreationContext(IHandler handler, IReleasePolicy releasePolicy, Type requestedType, IDictionary additionalArguments, ITypeConverter converter, CreationContext parent) { this.requestedType = requestedType; this.handler = handler; this.releasePolicy = releasePolicy; this.additionalArguments = EnsureAdditionalArgumentsWriteable(additionalArguments); this.converter = converter; if (parent != null) { resolutionStack = parent.resolutionStack; handlerStack = parent.handlerStack; return; } handlerStack = new Stack<IHandler>(4); resolutionStack = new Stack<ResolutionContext>(4); }
public virtual object Resolve(CreationContext context, ISubDependencyResolver contextHandlerResolver, ComponentModel model, DependencyModel dependency) { Debug.Assert(CanResolve(context, contextHandlerResolver, model, dependency), "CanResolve(context, contextHandlerResolver, model, dependency)"); object result = null; if (dependency.DependencyKey != null) { result = Resolve(dependency, additionalArguments[dependency.DependencyKey]); } return result ?? Resolve(dependency, additionalArguments[dependency.TargetType]); }
public ResolutionContext(CreationContext context, IHandler handler, bool requiresDecommission, bool trackContext) { this.context = context; this.requiresDecommission = requiresDecommission; this.trackContext = trackContext; this.handler = handler; }
public virtual bool CanResolve(CreationContext context, ISubDependencyResolver contextHandlerResolver, ComponentModel model, DependencyModel dependency) { return HasAdditionalArguments && (CanResolveByKey(dependency) || CanResolveByType(dependency)); }