/// <summary> /// Implementation of <see cref="IParameterBinder.Bind"/> /// and it is used to read the data available and construct the /// parameter type accordingly. /// </summary> /// <param name="controller">The controller instance</param> /// <param name="parameterInfo">The parameter info</param> /// <returns>The bound instance</returns> public virtual object Bind(SmartDispatcherController controller, ParameterInfo parameterInfo) { IDataBinder binder = CreateBinder(); ConfigureValidator(controller, binder); CompositeNode node = controller.ObtainParamsNode(From); object instance = binder.BindObject(parameterInfo.ParameterType, prefix, exclude, allow, node); BindInstanceErrors(controller, binder, instance); PopulateValidatorErrorSummary(controller, binder, instance); return instance; }
public override object Bind(SmartDispatcherController controller, ParameterInfo parameterInfo) { ARDataBinder binder = (ARDataBinder) CreateBinder(); ConfigureValidator(controller, binder); binder.AutoLoad = autoLoad; CompositeNode node = controller.ObtainParamsNode(From); object instance = binder.BindObject(parameterInfo.ParameterType, Prefix, Exclude, Allow, Expect, node); BindInstanceErrors(controller, binder, instance); PopulateValidatorErrorSummary(controller, binder, instance); return instance; }
/// <summary> /// Implementation of <see cref="IParameterBinder.CalculateParamPoints"/> /// and it is used to give the method a weight when overloads are available. /// </summary> /// <param name="controller">The controller instance</param> /// <param name="parameterInfo">The parameter info</param> /// <returns>Positive value if the parameter can be bound</returns> public int CalculateParamPoints(SmartDispatcherController controller, ParameterInfo parameterInfo) { CompositeNode node = controller.ObtainParamsNode(From); IDataBinder binder = CreateBinder(); return binder.CanBindObject(parameterInfo.ParameterType, prefix, node) ? 10 : 0; }