private HttpVerb GetNormalizedVerb(bool conventionalVerbs)
        {
            if (Verb != null)
            {
                return(Verb.Value);
            }
            var demo = Method.GetType();

            if (Method.IsDefined(typeof(HttpGetAttribute)))
            {
                return(HttpVerb.Get);
            }
            if (Method.IsDefined(typeof(System.SerializableAttribute)))
            {
            }
            if (Method.IsDefined(typeof(HttpPostAttribute)))
            {
                return(HttpVerb.Post);
            }

            if (Method.IsDefined(typeof(HttpPutAttribute)))
            {
                return(HttpVerb.Put);
            }

            if (Method.IsDefined(typeof(HttpDeleteAttribute)))
            {
                return(HttpVerb.Delete);
            }

            if (Method.IsDefined(typeof(HttpPatchAttribute)))
            {
                return(HttpVerb.Patch);
            }

            if (Method.IsDefined(typeof(HttpOptionsAttribute)))
            {
                return(HttpVerb.Options);
            }

            if (Method.IsDefined(typeof(HttpHeadAttribute)))
            {
                return(HttpVerb.Head);
            }

            if (conventionalVerbs)
            {
                var conventionalVerb = DynamicApiVerbHelper.GetConventionalVerbForMethodName(ActionName);
                if (conventionalVerb == HttpVerb.Get && !HasOnlyPrimitiveIncludingNullableTypeParameters(Method))
                {
                    conventionalVerb = DynamicApiVerbHelper.GetDefaultHttpVerb();
                }

                return(conventionalVerb);
            }

            return(DynamicApiVerbHelper.GetDefaultHttpVerb());
        }
        /// <summary>
        /// Builds <see cref="DynamicApiActionInfo"/> object for this configuration.
        /// </summary>
        /// <returns></returns>
        public DynamicApiActionInfo BuildActionInfo()
        {
            if (Verb == null)
            {
                Verb = DynamicApiVerbHelper.GetDefaultHttpVerb();
            }

            return(new DynamicApiActionInfo(ActionName, Verb.Value, _methodInfo, _filters));
        }
        /// <summary>
        /// Builds <see cref="DynamicApiActionInfo"/> object for this configuration.
        /// </summary>
        /// <returns></returns>
        public DynamicApiActionInfo BuildActionInfo()
        {
            if (
                Verb == null ||
                (Verb == HttpVerb.Get && !HasOnlyPrimitiveIncludingNullableTypeParameters(_methodInfo))
                )
            {
                Verb = DynamicApiVerbHelper.GetDefaultHttpVerb();
            }

            return(new DynamicApiActionInfo(ActionName, Verb.Value, _methodInfo, _filters));
        }
        private HttpVerb GetNormalizedVerb(bool conventionalVerbs)
        {
            if (Verb != null)
            {
                return(Verb.Value);
            }

            if (_methodInfo.IsDefined(typeof(HttpGetAttribute)))
            {
                return(HttpVerb.Get);
            }

            if (_methodInfo.IsDefined(typeof(HttpPostAttribute)))
            {
                return(HttpVerb.Post);
            }

            if (_methodInfo.IsDefined(typeof(HttpPutAttribute)))
            {
                return(HttpVerb.Put);
            }

            if (_methodInfo.IsDefined(typeof(HttpDeleteAttribute)))
            {
                return(HttpVerb.Delete);
            }

            if (conventionalVerbs)
            {
                var conventionalVerb = DynamicApiVerbHelper.GetConventionalVerbForMethodName(ActionName);
                if (conventionalVerb == HttpVerb.Get && !HasOnlyPrimitiveIncludingNullableTypeParameters(_methodInfo))
                {
                    conventionalVerb = DynamicApiVerbHelper.GetDefaultHttpVerb();
                }

                return(conventionalVerb);
            }

            return(DynamicApiVerbHelper.GetDefaultHttpVerb());
        }