Пример #1
0
        public ServiceMethod GetMethod(MethodInfo methodInfo, MethodContexts context)
        {
            var method = new ServiceMethod(_methodNameMapper.GetMethodName(methodInfo));

            var parameterContext = new MethodParameterContexts(context.Services);
            var responseContext  = new MethodResponseContexts(context.Services);

            method.SourceMethod = methodInfo;

            method.HttpMethod = _httpMethodMapper.MapHttpMethod(methodInfo);

            method.Parameters =
                (from parameterInfo in methodInfo.GetParameters()
                 let parameter = _serviceMethodParameterMapper.MapServiceMethodParameter(parameterInfo, parameterContext)
                                 where parameter != null
                                 select parameter).ToList();

            method.Url = _methodUrlMapper.MapMethodUrl(methodInfo, method.Parameters);

            method.Response = _methodReponseMapper.MapMethodResponse(methodInfo, responseContext);

            method.Comment = _commentsProvider.GetComment(methodInfo);

            return(method);
        }