Skip to content

When using Hosting startup I'm unable to configure most if any Aspire services #3861

@REscobar

Description

@REscobar

Is there an existing issue for this?

  • I have searched the existing issues

Is your feature request related to a problem? Please describe the problem.

Context: In some of my company's application we use HostingStartup to configure optional parts of our application like which database system to use (SqlServer, PostgreSQL, etc), this allows us to support additional database backends without modifying existing code (Open/Closed principle), we also use this to plug in other miscellaneous features like which telemetry sink we use (OTel, LGTM, Azure Monitor, etc) becuase it allows us to conditionally bring in dependencies and conditionally register services.

Problem: I want to enrich an Entity Framework context, but I'm unable to do so becuase the enrich method requires access to IHostApplicationBuilder which is unavalable inside any of the members of IWebHostBuilder (which is provided by HostingStartup)

Describe the solution you'd like

Either a way to call enrich on any of members exposed by IWebHostBuilder.
Or a way to obtain the base IHostApplicationBuilder to then call the Aspire methods on.
Or a way to create a stand-in IHostApplicationBuilder from any of the members exposed by IWebHostBuilder and then call the Aspire methods on.

Additional context

I can provide a sample application that shows how we are using HostingStartup if required.


Associated WorkItem - 478451

Metadata

Metadata

Labels

📌 seQUESTeredIdentifies that an issue has been imported into Quest.

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions