// Set up application services public void ConfigureServices(IServiceCollection services) { services.AddTransient <ILoggerFactory, LoggerFactory>(); var wellKnownChangeToken = new WellKnownChangeToken(); services.AddControllers(options => { options.Filters.AddService(typeof(ApiExplorerDataFilter)); options.Conventions.Add(new ApiExplorerVisibilityEnabledConvention()); options.Conventions.Add(new ApiExplorerVisibilityDisabledConvention( typeof(ApiExplorerVisibilityDisabledByConventionController))); options.Conventions.Add(new ApiExplorerInboundOutboundConvention( typeof(ApiExplorerInboundOutBoundController))); options.Conventions.Add(new ApiExplorerRouteChangeConvention(wellKnownChangeToken)); options.OutputFormatters.Clear(); options.OutputFormatters.Add(new XmlDataContractSerializerOutputFormatter()); }) .AddNewtonsoftJson(); services.AddSingleton <ApiExplorerDataFilter>(); services.AddSingleton <IActionDescriptorChangeProvider, ActionDescriptorChangeProvider>(); services.AddSingleton(wellKnownChangeToken); }
public IActionResult Reload([FromServices] WellKnownChangeToken changeToken) { changeToken.TokenSource.Cancel(); return(Ok()); }
public ApiExplorerRouteChangeConvention(WellKnownChangeToken changeToken) { ChangeToken = changeToken; }
public ActionDescriptorChangeProvider(WellKnownChangeToken changeToken) { ChangeToken = changeToken; }