Skip to content

Add IAsyncStartup and IAsyncStartupFilter to support async startup classes and filters #5897

Closed
@analogrelay

Description

@analogrelay

We should introduce a new set of interfaces: IAsyncStartup and IAsyncStartupFilter with the following API surface:

    public interface IAsyncStartup
    {
        IServiceProvider ConfigureServices(IServiceCollection services);

        Task ConfigureAsync(IApplicationBuilder app);
    }

    public interface IAsyncStartupFilter
    {
        Func<IApplicationBuilder, Task> Configure(Func<IApplicationBuilder, Task> next);
    }

Startup classes will now support a Task ConfigureAsync(IApplicationBuilder app) method, which is mutually exclusive with void Configure(IApplicationBuilder app). It shall be an error to have both methods on a startup class.

IAsyncStartup and IAsyncStartupFilter will be the primitives used by the entire Hosting pipeline. Adapters will exist in Hosting to allow the continued use of IStartup and IStartupFilter in the public API surface (to reduce breaking changes).

Metadata

Metadata

Assignees

No one assigned

    Labels

    affected-mediumThis issue impacts approximately half of our customersarea-hostingIncludes Hostingarea-networkingIncludes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractionsenhancementThis issue represents an ask for new feature or an enhancement to an existing oneseverity-minorThis label is used by an internal tool

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions