Adding support for ActivateAttribute via IControllerActivator

This mechanism replaces code in Inject that activated properties
by looking them up by names.


This about testing the behavior

-----Original Message-----
From: "Pranav K" <notifications@github.com>
Sent: ‎6/‎20/‎2014 6:07 AM
To: "aspnet/Mvc" <Mvc@noreply.github.com>
Cc: "Yishai Galatzer" <yishai_galatzer@yahoo.com>
Subject: Re: [Mvc] Adding support for ActivateAttribute viaIControllerActivator (#648)

In src/Microsoft.AspNet.Mvc.Core/DefaultControllerActivator.cs:
> +            private readonly PropertyInfo _propertyInfo;
> +            private readonly Func<ActionContext, object> _valueAccessor;
> +            private readonly Action<object, object> _fastPropertySetter;
> +
> +            public ActivateInfo(PropertyInfo propertyInfo,
> +                                Func<ActionContext, object> valueAccessor)
> +            {
> +                _propertyInfo = propertyInfo;
> +                _valueAccessor = valueAccessor;
> +                _fastPropertySetter = PropertyHelper.MakeFastPropertySetter(propertyInfo);
> +            }
> +
> +            public void Activate(object instance, ActionContext context)
> +            {
> +                var value = _valueAccessor(context);
> +                _fastPropertySetter(instance, value);
Isn't the same question as #648 (comment)? We let the DI's behavior control the result
—
Reply to this email directly or view it on GitHub.