Exemple #1
0
        public void Build(IEndpoint endpoint, IRouteBuilder builder)
        {
            if (methodNameMethod.ContainsKey(endpoint.Method.Name))
                builder.RestrictMethods(methodNameMethod[endpoint.Method.Name]);

            var namespacePart = (endpoint.HandlerType.Namespace ?? string.Empty).Split('.').LastOrDefault();
            if (!string.IsNullOrEmpty(namespacePart) && !namespacePartsToIgnore.Contains(namespacePart))
                builder.Append(namespacePart.ToLower());

            if (!handlerNamesToIgnore.Contains(endpoint.HandlerType.Name))
                builder.Append(endpoint.HandlerType.Name.ToLower());

            var input = endpoint.Method.GetParameters().FirstOrDefault();
            if (input == null) return;

            var inputParameters = input.ParameterType.GetProperties();
            foreach (var parameter in inputParameters)
            {
                builder.AppendParameter(new RouteParameter(parameter));
            }
        }