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);
        }
Example #2
0
        public ServiceMethodResponse MapMethodResponse(MethodInfo methodInfo, MethodResponseContexts context)
        {
            var response = new ServiceMethodResponse();

            var typeContext = new TypeReferenceContext(context.Services.Definitions);

            response.SourceMethod = methodInfo;
            response.Type         = _returnTypeMapper.GetReturnType(methodInfo, typeContext);

            return(response);
        }