-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
API Proposal: Expose Host.ConfigureDefaults #36003
Comments
Do you have more specific details on the proposal? This is pretty low on info/details. |
This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment. If it is closed, feel free to comment when you are able to provide the additional information and we will re-investigate. See our Issue Management Policies for more information. |
I had to copy the defaults because I wanted to use a different IHostBuilder implementation https://github.com/davidfowl/FeatherHttp/blob/ee5e2a8a701b73b1e57c5d4df5672fda63366779/src/FeatherHttp/WebApplication.cs#L221. The request is simple, I’d rather not copy this logic 😬 |
I couldn't figure out the best area label to add to this issue. Please help me learn by adding exactly one area label. |
API Proposal Summary: The ask is to move the IHostBuilder instantiation below out of the new API, so other callers can provide their own IHostBuilder to CreateDefaultBuilder
namespace Microsoft.Extensions.Hosting
{
public static partial class Host
{
public static Microsoft.Extensions.Hosting.IHostBuilder CreateDefaultBuilder() { throw null; }
public static Microsoft.Extensions.Hosting.IHostBuilder CreateDefaultBuilder(string[] args) { throw null; }
+ public static Microsoft.Extensions.Hosting.IHostBuilder CreateDefaultBuilder(IHostBuilder builder, string[] args) { throw null; }
}
} |
namespace Microsoft.Extensions.Hosting
{
public static partial class HostingHostBuilderExtensions
{
public static IHostBuilder ConfigureDefaults(this IHostBuilder builder, string[] args);
}
} |
Nice! |
If you're okay with it @maryamariyan and @davidfowl, I'd love to work on this? |
Do it! |
…uilder interface. Fix dotnet#36003
…ilder` (#50447) * Added the ConfigureDefaults API, as an extension method on the IHostBuilder interface. Fix #36003 * Apply suggestions from code review Co-authored-by: Eric Erhardt <eric.erhardt@microsoft.com> * Update src/libraries/Microsoft.Extensions.Hosting/src/Host.cs Co-authored-by: Eric Erhardt <eric.erhardt@microsoft.com>
This would allow callers to provide the IHostBuilder instance without having to copy all the logic to setup defaults.
The text was updated successfully, but these errors were encountered: