public override void Deactivate(FeaturesBootstrapContext ctx) { var dependencyResolver = Previous; if (dependencyResolver != null) { var config = ctx.Get<HttpConfiguration>(); config.DependencyResolver = dependencyResolver; } }
public override void Deactivate(FeaturesBootstrapContext ctx) { if (Previous != null) { var formatters = ctx.Get<HttpConfiguration>().Formatters; formatters.Clear(); formatters.AddRange(Previous); } }
public override void Activate(FeaturesBootstrapContext ctx) { var config = ctx.Get<HttpConfiguration>(); var swagger = config.EnableSwagger(ConfigureSwaggerDocs); if (UseSwaggerUi) { swagger.EnableSwaggerUi(); } }
public override void Activate(FeaturesBootstrapContext ctx) { var formatters = ctx.Get<HttpConfiguration>().Formatters; Previous = formatters.ToArray(); var json = formatters.JsonFormatter; var xml = formatters.XmlFormatter; formatters.Clear(); if (UseJson) { json.SerializerSettings.ContractResolver = new CamelCasePropertyNamesContractResolver(); json.SerializerSettings.ReferenceLoopHandling = ReferenceLoopHandling.Ignore; json.SerializerSettings.Converters.Add(new StringEnumConverter()); formatters.Add(json); } if (UseXml) { xml.UseXmlSerializer = true; formatters.Add(xml); } }
public override void Activate(FeaturesBootstrapContext ctx) { var config = ctx.Get<HttpConfiguration>(); config.MapHttpAttributeRoutes(); config.Routes.MapHttpRoute("DefaultApi", "api/{controller}/{id}", new { id = RouteParameter.Optional }); }
private static void RegisteredServices(FeaturesBootstrapContext ctx) { var app = ctx.Get<IAppBuilder>(); var configuration = ctx.Get<HttpConfiguration>(); app.UseWebApi(configuration); }
private void OnRegisteredServices(FeaturesBootstrapContext ctx) { var config = ctx.Get<HttpConfiguration>(); var serviceProvider = ctx.Get<IServiceProvider>(); config.DependencyResolver = new WebApiDependencyResolver(serviceProvider, Previous); }
public override void Activate(FeaturesBootstrapContext ctx) { var config = ctx.Get<HttpConfiguration>(); Previous = config.DependencyResolver; }
private void OnRegisteredServices(FeaturesBootstrapContext ctx) { var serviceProvider = ctx.Get<IServiceProvider>(); DependencyResolver.SetResolver(new MvcDependencyResolver(serviceProvider, Previous)); }