microsoft / microsoft/aspire

npgsql ef integration doesn't provide a callback that accepts an `IServiceProvider`

Open
#7,016 7 comments 1 reaction 0 assignees View on GitHub
area-integrations postgres
Dominant language
C#
Stars
6.3k
Forks
991
Avg merge
2d 15h
Merged PRs (30d)
196

Description

### Is there an existing issue for this?

- [x] I have searched the existing issues

### Describe the bug

I'm porting a codebase to use .NET Aspire and the way that it configures the DbContext is that it uses the callback that takes an `IServiceProvider` and the options builder: https://learn.microsoft.com/en-us/dotnet/api/microsoft.extensions.dependencyinjection.entityframeworkservicecollectionextensions.adddbcontext?view=efcore-9.0#microsoft-extensions-dependencyinjection-entityframeworkservicecollectionextensions-adddbcontext-1(microsoft-extensions-dependencyinjection-iservicecollection-system-action((system-iserviceprovider-microsoft-entityframeworkcore-dbcontextoptionsbuilder))-microsoft-extensions-dependencyinjection-servicelifetime-microsoft-extensions-dependencyinjection-servicelifetime)

Aspire doesn't provide access to this, only to the one that takes the `DbContextOptionsBuilder`, which means that we have to refactor how things are configured.

### Expected Behavior

If the Aspire integration is going to "shadow" the native integration, it should match the API surface area.

### Steps To Reproduce

_No response_

### Exceptions (if any)

_No response_

### .NET Version info

_No response_

### Anything else?

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.