public GenerateProvider(IApiResolver apiResolver, IApiSerializer apiSerializer, ITypeRegister typeRegister, IXmlDocmentationReader xmlDocmentationReader)
 {
     ApiResolver           = apiResolver;
     ApiSerializer         = apiSerializer;
     TypeRegister          = typeRegister;
     XmlDocmentationReader = xmlDocmentationReader;
 }
Beispiel #2
0
        private Dictionary <string, string> CreateResponse(IApiSerializer apiResponder, IApiStandartResponce response, ApiContext apiContext)
        {
            var examples = new Dictionary <string, string>();

            foreach (var extension in apiResponder.GetSupportedExtensions().Where(extension => _responseFormats.Contains(extension)))
            {
                //Create request context
                using (var writer = new StringWriter())
                {
                    var contentType = apiResponder.RespondTo(response, writer, "dummy" + extension, string.Empty, true, false);
                    writer.Flush();
                    examples[contentType.MediaType] = writer.GetStringBuilder().ToString();
                }
            }
            return(examples);
        }
Beispiel #3
0
        private Dictionary <string, string> CreateResponse(IApiSerializer apiResponder, IApiStandartResponce responce, ApiContext apiContext)
        {
            var examples = new Dictionary <string, string>();

            try
            {
                foreach (var extension in apiResponder.GetSupportedExtensions())
                {
                    //Create request context
                    using (var writer = new StringWriter())
                    {
                        var contentType = apiResponder.RespondTo(responce, writer, "dummy" + extension, string.Empty, true, false);
                        writer.Flush();
                        examples.Add(contentType.MediaType, writer.GetStringBuilder().ToString());
                    }
                }
            }
            catch (Exception)
            {
                throw;
            }
            return(examples);
        }