Esempio n. 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);
        }
Esempio n. 2
0
        public ServiceMethodParameter MapServiceMethodParameter(ParameterInfo parameterInfo, MethodParameterContexts context)
        {
            var name      = _parameterNameMapper.MapParameterName(parameterInfo);
            var parameter = new ServiceMethodParameter(name);

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

            parameter.Source   = parameterInfo;
            parameter.PassOver = _parameterPassOverMapper.MapPassOver(parameterInfo);
            parameter.Type     = _parameterTypeMapper.GetParameterType(parameterInfo, propertyContext);

            return(parameter);
        }