/// <summary> /// Applies user supplied override values to instance properties. /// </summary> /// <param name="context">The context.</param> /// <param name="reference">A reference to the instance being activated.</param> /// <param name="propertyValues">The parameter ovverride value accessors.</param> private void AssignProperyOverrides(IContext context, InstanceReference reference, IEnumerable <IParameter> propertyValues) { var properties = reference.Instance.GetType().GetProperties(Flags); foreach (var propertyValue in propertyValues) { string propertyName = propertyValue.Name; var propertyInfo = properties .Where(property => string.Equals(property.Name, propertyName, StringComparison.Ordinal)) .FirstOrDefault(); if (propertyInfo == null) { throw new ActivationException(ExceptionFormatter.CouldNotResolveProperyForValueInjection(context.Request, propertyName)); } var target = new PropertyInjectionDirective(propertyInfo, InjectorFactory.Create(propertyInfo)); object value = GetValue(context, target.Target); target.Injector(reference.Instance, value); } }