Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Startup Async Configure #14801

Merged
merged 8 commits into from
Dec 2, 2023
Merged

Startup Async Configure #14801

merged 8 commits into from
Dec 2, 2023

Conversation

jtkech
Copy link
Member

@jtkech jtkech commented Dec 1, 2023

@MikeAlhayek

Fixes #14784, related to #14798

You can try this pattern that I used to configure the RequestLocalizationMiddleware

@jtkech
Copy link
Member Author

jtkech commented Dec 1, 2023

Added OCBuilder helpers to allow

builder.Services
    .AddOrchardCms()
    .AddSetupFeatures("OrchardCore.AutoSetup")
    .Configure(async (app, routes, sp) =>
     {
         await Task.Delay(1000);
     }, order: 10)
    .Configure(async (app, routes) =>
    {
        await Task.Delay(1000);
    }, order:10)
    .Configure(async (app) =>
    {
        await Task.Delay(1000);
    }, order:10);

@jtkech
Copy link
Member Author

jtkech commented Dec 1, 2023

One last thing is that all async configure will run before non async configure.

Maybe better that for each startup (ordered by their Oder property) we call both its async and non async configure. But as said would need to override UseEndpoints() so that it accepts an async delegate.

@jtkech
Copy link
Member Author

jtkech commented Dec 1, 2023

Okay I found a way to allow the async configure to also configure routes.

And now async configure and non async configure are called pair by pair for each startup, no longer all async configure before all non async configure.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants