Allow configuring of the ServiceProvider on DistributedApplicationBuilder
- Dominant language
- C#
- Stars
- 6.3k
- Forks
- 991
- Avg merge
- 2d 15h
- Merged PRs (30d)
- 196
Description
There is currently no way to configure the ServiceProvider on DistributedApplicationBuilder. Say I don't want to use MEDI, and I want to use a different DI provider. Or I want to be able to modify the `ServiceProviderOptions` used when building the service provider.
IHostApplicationBuilder has this method:
```
///
/// Registers a instance to be used to create the .
///
/// The factory object that can create the and .
///
/// A delegate used to configure the . This can be used to configure services using
/// APIS specific to the implementation.
///
/// The type of builder provided by the .
///
///
/// The is created when this builder is built and so the delegate provided
/// by will run after all other services have been registered.
///
///
/// Multiple calls to will replace
/// the previously stored and delegate.
///
///
void ConfigureContainer(IServiceProviderFactory factory, Action? configure = null) where TContainerBuilder : notnull
```
[WebAssemblyHostBuilder](https://github.com/dotnet/aspnetcore/blob/10517269f40d53eb22cce6b4d520ed27ed1e1b9f/src/Components/WebAssembly/WebAssembly/src/Hosting/WebAssemblyHostBuilder.cs#L248-L267) and [MauiAppBuilder](https://github.com/dotnet/maui/blob/d91e682cd1da4cbf5651e1002297f7f5c255f398/src/Core/src/Hosting/MauiAppBuilder.cs#L107-L126) both have similar methods (but doesn't implement IHostApplicationBuilder).
We should add the same method to DistributedApplicationBuilder.
cc @mitchdenny @davidfowl
Contributor guide
Assessment
This issue has not been assessed yet.