public HttpResponseMessage Fickle() { var options = new ServiceModelReflectionOptions { ControllersTypesToIgnore = controllersToIgnore }; var reflector = new WebApiRuntimeServiceModelReflector(options, this.Configuration, this.GetType().Assembly, Request.RequestUri.Host); var serviceModel = reflector.Reflect(); var content = new PushStreamContent( (stream, httpContent, transportContext) => { using (var streamWriter = new StreamWriter(stream)) { var writer = new FicklefileWriter(streamWriter); writer.Write(serviceModel); } }, new MediaTypeHeaderValue("text/fickle")); var response = new HttpResponseMessage { Content = content }; return(response); }
public HttpResponseMessage Fickle() { var options = new ServiceModelReflectionOptions { ControllersTypesToIgnore = new[] { this.GetType() } }; var reflector = new WebApiRuntimeServiceModelReflector(options, this.Configuration, this.GetType().Assembly, Request.RequestUri.Host); var serviceModel = reflector.Reflect(); var content = new PushStreamContent( (stream, httpContent, transportContext) => { using (var streamWriter = new StreamWriter(stream)) { var writer = new FicklefileWriter(streamWriter); writer.Write(serviceModel); } }, new MediaTypeHeaderValue("text/fickle")); var response = new HttpResponseMessage { Content = content }; return response; }
private static Model.ServiceModel ReflectServiceModel() { var options = new ServiceModelReflectionOptions(); var configuration = new HttpConfiguration(); configuration.Routes.MapHttpRoute ( name: "DefaultApi", routeTemplate: "api/{controller}/{action}" ); configuration.EnsureInitialized(); var assembly = Assembly.Load("Fickle.WebApi.Tests.ServiceModel"); var reflector = new WebApiRuntimeServiceModelReflector(options, configuration, assembly, "localhost"); return(reflector.Reflect()); }
private static Model.ServiceModel ReflectServiceModel() { var options = new ServiceModelReflectionOptions(); var configuration = new HttpConfiguration(); configuration.Routes.MapHttpRoute ( name: "DefaultApi", routeTemplate: "api/{controller}/{action}" ); configuration.EnsureInitialized(); var assembly = Assembly.Load("Fickle.WebApi.Tests.ServiceModel"); var reflector = new WebApiRuntimeServiceModelReflector(options, configuration, assembly, "localhost"); return reflector.Reflect(); }