protected virtual void ConfigureWebApi(HttpConfiguration config, IContainer container) { config.IncludeErrorDetailPolicy = Settings.ShowExceptionDetails ? IncludeErrorDetailPolicy.Always : IncludeErrorDetailPolicy.Default; config.MessageHandlers.Add(new CrossOriginMessageHandler(Settings.EnableCrossDomainRequests)); config.Filters.Add(new ExceptionLoggingFilter()); var documentation = new HtmlDocumentation(); documentation.Load(); config.Services.Replace(typeof(IDocumentationProvider), new WebApiHtmlDocumentationProvider(documentation)); config.Services.Replace(typeof(IExceptionHandler), new LoggingExceptionHandler()); var formatter = CreateMicrodataFormatter(); config.Formatters.Add(formatter); config.Formatters.Remove(config.Formatters.XmlFormatter); config.Formatters.AddRange(container.Resolve <IEnumerable <MediaTypeFormatter> >()); config.Formatters.JsonFormatter.SerializerSettings.ContractResolver = new CamelCasePropertyNamesContractResolver(); config.Formatters.JsonFormatter.SerializerSettings.Converters.Add(new StringEnumConverter()); config.Formatters.JsonFormatter.SerializerSettings.Formatting = Formatting.Indented; }
public static void ConfigureDocumentationProvider() { var config = GlobalConfiguration.Configuration; var documentation = new HtmlDocumentation(); documentation.Load(); config.Services.Replace(typeof(IDocumentationProvider), new WebApiHtmlDocumentationProvider(documentation)); var routes = config.Routes; MapDocumentationRoutes(routes); }
protected virtual void ConfigureWebApi(HttpConfiguration config) { config.IncludeErrorDetailPolicy = Settings.ShowExceptionDetails ? IncludeErrorDetailPolicy.Always : IncludeErrorDetailPolicy.Default; config.MessageHandlers.Add(new CrossOriginMessageHandler(Settings.EnableCrossDomainRequests)); config.Filters.Add(new ExceptionLoggingFilter()); var documentation = new HtmlDocumentation(); documentation.Load(); config.Services.Replace(typeof(IDocumentationProvider), new WebApiHtmlDocumentationProvider(documentation)); config.Services.Replace(typeof(IExceptionHandler), new LoggingExceptionHandler()); config.Formatters.JsonFormatter.SerializerSettings.ContractResolver = new CamelCasePropertyNamesContractResolver(); config.Formatters.JsonFormatter.SerializerSettings.Converters.Add(new StringEnumConverter()); config.Formatters.JsonFormatter.SerializerSettings.Formatting = Formatting.Indented; }
public static void ConfigureWebApi(HttpConfiguration config) { config.IncludeErrorDetailPolicy = NuGetWebApiModule.ShowExceptionDetails ? IncludeErrorDetailPolicy.Always : IncludeErrorDetailPolicy.Default; config.MessageHandlers.Add(new CrossOriginMessageHandler(NuGetWebApiModule.EnableCrossDomainRequests)); config.Filters.Add(new ExceptionLoggingFilter()); var documentation = new HtmlDocumentation(); documentation.Load(); config.Services.Replace(typeof(IDocumentationProvider), new WebApiHtmlDocumentationProvider(documentation)); config.Formatters.Add(CreateHtmlFormatter()); config.Formatters.Remove(config.Formatters.XmlFormatter); config.Formatters.Add(new PackageFormDataMediaFormatter()); config.Formatters.JsonFormatter.SerializerSettings.ContractResolver = new CamelCasePropertyNamesContractResolver(); config.Formatters.JsonFormatter.SerializerSettings.Converters.Add(new StringEnumConverter()); config.Formatters.JsonFormatter.SerializerSettings.Formatting = Formatting.Indented; }