Skip to content

Redesign EF components public API #1403

@eerhardt

Description

@eerhardt

We've gotten feedback about missing EF scenarios - it started with Npgsql component doesn't allow configuration of the NpgsqlDbContextOptionsBuilder. We we fixed this by allowing to configure the DbContextOptionsBuilder, but this had the problem that the user needed to call UseNpgsql again to configure Npgsql specific options. Npgsql and SqlServer work this way, but CosmosDB doesn't - the UseCosmos API forces callers to pass a connection string, or other connection information.

Then more feedback came in that we don't support all the options that EF allows w.r.t. DependencyInjection:

Given all this feedback, and diving into the EF APIs, we think we need to redesign the Aspire EF component's public APIs. Today we are wrapping the EF APIs for Pooling or regular DbContext.

But instead, we should have the dev user call directly into the EF DependencyInjection APIs, so they have full control over what they want to add to the app. Then the Aspire EF Component can just have an extension method to add the other things:

  • Health Checks
  • Tracing
  • Metrics
  • Tracing
  • Logging
  • etc

The hard part will be coming up with the naming of that Aspire extension method. It can't be called AddNpgsqlDbContext anymore, since it doesn't add the DbContext.

Metadata

Metadata

Assignees

Labels

area-integrationsIssues pertaining to Aspire Integrations packages

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions