background
I hope to add additional middleware by registering the plugin without changing the original project code, but how to get the IApplicationBuilder required to register the middleware in the plugin is the biggest problem I currently face.
According to the Hosting Startup Document, the plugin can be registered by inheriting IHostingStartup and loaded automatically when the project starts, E.g:
// plugin
public class MyStartup: IHostingStartup
{
// Implement the IHostingStartup interface
public void Configure(IWebHostBuilder builder)
{
// TODO: I want to get an IApplicationBuilder object to register middleware
}
}
question
How to get IApplicationBuilder object by IWebHostBuilder?