MessagePipe icon indicating copy to clipboard operation
MessagePipe copied to clipboard

Support Host.CreateApplicationBuilder with an IServiceCollection extension

Open kmgallahan opened this issue 2 years ago • 1 comments

There is a new Host.CreateApplicationBuilder method that appears to be preferred over Host.CreateDefaultBuilder.

Per the .NET runtime team:

We moved away from the ceremony of a generic host in the default templates and to the scenario specific WebApplicationBuilder. The general idea was to move away from calbacks and move to linear code for configuring everything, this was part of .NET 6. In .NET 7, we added var builder = Host.CreateApplicationBuilder() as the backbone of WebApplication.CreateBuilder so we could have a smoother integration of the API styles (building the linear API on top of the callback API was error prone).

https://github.com/dotnet/runtime/discussions/81090#discussioncomment-4784551


Serilog handled this by adding a UseSerilog extension method for IServiceCollection and updating the IHostBuilder extension implementation to use it:

https://github.com/serilog/serilog/issues/1855

https://github.com/serilog/serilog-extensions-hosting/pull/70


Note Host.CreateApplicationBuilder is only available from .NET 7+

kmgallahan avatar Apr 14 '23 13:04 kmgallahan

This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 30 days.

github-actions[bot] avatar Oct 12 '23 00:10 github-actions[bot]

MessagePipe provides the extensions to IServiceCollection and does not depend on IHostBuilder.

So the following is valid.

var builder = Host.CreateApplicationBuilder();
builder.Services.AddMessagePipe();

What exactly does "support" mean ?

hadashiA avatar Mar 29 '24 02:03 hadashiA