/// <summary>
        /// Applies 'From...' attributes from a source parameter to a parameter builder.
        /// </summary>
        /// <param name="parameterInfo">A parameter info.</param>
        /// <param name="parameterBuilder">A parameter builder.</param>
        private void ApplyParameterAttributes(
            ParameterInfo parameterInfo,
            IParameterBuilder parameterBuilder)
        {
            var attrs = parameterInfo.GetCustomAttributes();

            if (attrs == null)
            {
                return;
            }

            foreach (var attr in attrs)
            {
                if (attr is FromBodyAttribute)
                {
                    parameterBuilder.SetCustomAttribute(AttributeUtility.BuildAttribute <FromBodyAttribute>());
                }
                else if (attr is FromHeaderAttribute)
                {
                    parameterBuilder.SetCustomAttribute(
                        AttributeUtility.BuildAttribute <FromHeaderAttribute>(
                            () =>
                    {
                        return(this.GetPropertiesAndValues(attr, "Name"));
                    }));
                }
                else if (attr is FromQueryAttribute)
                {
                    parameterBuilder.SetCustomAttribute(
                        AttributeUtility.BuildAttribute <FromQueryAttribute>(
                            () =>
                    {
                        return(this.GetPropertiesAndValues(attr, "Name"));
                    }));
                }
                else if (attr is FromRouteAttribute)
                {
                    parameterBuilder.SetCustomAttribute(
                        AttributeUtility.BuildAttribute <FromRouteAttribute>(
                            () =>
                    {
                        return(this.GetPropertiesAndValues(attr, "Name"));
                    }));
                }
                else if (attr is FromServicesAttribute)
                {
                    parameterBuilder.SetCustomAttribute(AttributeUtility.BuildAttribute <FromServicesAttribute>());
                }
            }
        }
 /// <summary>
 /// Applies method parameter attributes to a parameter builder.
 /// </summary>
 /// <param name="parmBuilder">A parameter builder.</param>
 /// <param name="methodParm">A method parameter attribute.</param>
 private void ApplyParameterAttributes(
     IParameterBuilder parmBuilder,
     ControllerMethodParameterAttribute methodParm)
 {
     if (methodParm.From == ControllerMethodParameterFromOption.Body)
     {
         parmBuilder.SetCustomAttribute(AttributeUtility.BuildAttribute <FromBodyAttribute>());
     }
     else if (methodParm.From == ControllerMethodParameterFromOption.Header)
     {
         parmBuilder.SetCustomAttribute(AttributeUtility.BuildAttribute <FromHeaderAttribute>(
                                            () =>
         {
             var prop = typeof(FromHeaderAttribute).GetProperty("Name");
             return(new[] { new Tuple <PropertyInfo, object>(prop, methodParm.FromName) });
         }));
     }
     else if (methodParm.From == ControllerMethodParameterFromOption.Query)
     {
         parmBuilder.SetCustomAttribute(AttributeUtility.BuildAttribute <FromQueryAttribute>(
                                            () =>
         {
             var prop = typeof(FromQueryAttribute).GetProperty("Name");
             return(new[] { new Tuple <PropertyInfo, object>(prop, methodParm.FromName) });
         }));
     }
     else if (methodParm.From == ControllerMethodParameterFromOption.Route)
     {
         parmBuilder.SetCustomAttribute(AttributeUtility.BuildAttribute <FromRouteAttribute>(
                                            () =>
         {
             var prop = typeof(FromQueryAttribute).GetProperty("Name");
             return(new[] { new Tuple <PropertyInfo, object>(prop, methodParm.FromName) });
         }));
     }
 }