Skip to content

Conversation

@gilmar-sales
Copy link

@gilmar-sales gilmar-sales commented Jun 12, 2024

Support for BuildHost with the HostApplicationBuilder:

 public class Startup
{
        // with
        public void ConfigureHostApplicationBuilder(IHostApplicationBuilder hostApplicationBuilder)
        {
            // do something here...
        }

        // will be able to
        public IHost BuildHostApplicationBuilder(HostApplicationBuilder hostApplicationBuilder)
        {
            var hostApplication = hostApplicationBuilder.Build();
            // do something here...
            return hostApplication;
        }
}

@WeihanLi
Copy link
Contributor

Could it be configured in the Configure method? We could inject any service registered in the service collection like IServiceProvider

@gilmar-sales
Copy link
Author

Configure method doesn't allow access to the IHost instance like the BuildHost method for the CreateHostBuilder, this could help if thirdparty libraries uses the IHost instead of the IServiceProvider

@WeihanLi
Copy link
Contributor

what about supporting IHost in the Configure method?

@pengweiqhca
Copy link
Owner

pengweiqhca commented Jun 16, 2024

Configure method doesn't allow access to the IHost instance like the BuildHost method for the CreateHostBuilder, this could help if thirdparty libraries uses the IHost instead of the IServiceProvider

That is not work?

public static void Configure(IHost host) => Counter++;

image

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