Exemple #1
0
        private void MapMethod(MethodInfo info)
        {
            var ctx = TryGetVerb(info) ?? new MethodContext {
                ActionName = info.Name.ToLower()
            };


            MethodMapping mapping;

            if (!_methods.TryGetValue(ctx.ActionName.ToLower(), out mapping))
            {
                mapping = new MethodMapping();
                _methods.Add(ctx.ActionName, mapping);
            }

            // specified a verb
            if (!string.IsNullOrEmpty(ctx.HttpMethod))
            {
                _logger.Trace("Mapped " + ControllerUri + "." + ctx.ActionName + " to " + ctx.HttpMethod);
                mapping.IsMethodsSpecified = true;
                mapping.Add(ctx.HttpMethod, info);
            }


            if (!mapping.IsMethodsSpecified)
            {
                _logger.Trace("Mapped " + ControllerUri + "." + ctx.ActionName + " to ALL verbs");
                mapping.Add(Method.Unknown, info);
            }
        }
Exemple #2
0
        private void MapMethod(MethodInfo info)
        {
            var ctx = TryGetVerb(info) ?? new MethodContext {ActionName = info.Name.ToLower()};


            MethodMapping mapping;
            if (!_methods.TryGetValue(ctx.ActionName.ToLower(), out mapping))
            {
                mapping = new MethodMapping();
                _methods.Add(ctx.ActionName, mapping);
            }

            // specified a verb
            if (!string.IsNullOrEmpty(ctx.HttpMethod))
            {
                _logger.Trace("Mapped " + ControllerUri + "." + ctx.ActionName + " to " + ctx.HttpMethod);
                mapping.IsMethodsSpecified = true;
                mapping.Add(ctx.HttpMethod, info);
            }


            if (!mapping.IsMethodsSpecified)
            {
                _logger.Trace("Mapped " + ControllerUri + "." + ctx.ActionName + " to ALL verbs");
                mapping.Add(Method.Unknown, info);
            }
        }