Skip to content

Add DbContextOptions lifetime configuration support to Aspire.Microsoft.EntityFrameworkCore.SqlServer #13350

@zprobinson

Description

@zprobinson

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.

I am trying to leverage Aspire to build out a development environment to test the WolverineFx framework.

It recommends (see link) to use the Singleton ServiceLifetime for DbContextOptions for performance benefits.

Using the provided API from Aspire.Microsoft.EntityFrameworkCore.SqlServer, this does not seem possible.

Describe the solution you'd like

I would love to be able to provide the lifetime options for the DbContext options into the registration extension method.

One of the benefits of the client aspire library is being able to just leverage the name of the Resource from the AppHost for service discovery. An alternative solution would be to use the base .UseSqlServer extension method overload and find the connection string manually. I don't immediately know the conventions by which Aspire creates those connection strings, which makes this options (although functional), slightly more difficult than the other.

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions