Skip to content

Adds overload for AddSqlServerDbContext - Aspire.Microsoft.EntityFrameworkCore.SqlServer#4803

Closed
Juulsn wants to merge 1 commit intomicrosoft:mainfrom
Juulsn:main
Closed

Adds overload for AddSqlServerDbContext - Aspire.Microsoft.EntityFrameworkCore.SqlServer#4803
Juulsn wants to merge 1 commit intomicrosoft:mainfrom
Juulsn:main

Conversation

@Juulsn
Copy link
Copy Markdown

@Juulsn Juulsn commented Jul 7, 2024

There was no overload for AddSqlServerDbContext in Aspire.Microsoft.EntityFrameworkCore.SqlServer where configureDbContextOptions has an IServiceProvider as delegate parameter.

Microsoft Reviewers: Open in CodeFlow

@ghost ghost added the area-integrations Issues pertaining to Aspire Integrations packages label Jul 7, 2024
@dotnet-policy-service dotnet-policy-service Bot added the community-contribution Indicates that the PR has been added by a community member label Jul 7, 2024
@Juulsn
Copy link
Copy Markdown
Author

Juulsn commented Jul 7, 2024

@dotnet-policy-service agree

@eerhardt
Copy link
Copy Markdown
Member

eerhardt commented Jul 8, 2024

Thanks for the contribution, @derjuulsn.

  1. The build is currently failing. Can you fix it?
  2. Check out Pass IServiceProvider to configureBuilder of AddKafkaConsumer and AddKafkaProducer #4327, where we did something similar for Kafka. I think we may need more overloads.
  3. If we are doing this for SqlServer, we should do it for the other EF libraries as well.
  4. In EntityFramework.Core 9.0, we've fixed composability of DbContextOptions with Add DbContextOptions composibility support dotnet/efcore#32518. We may no longer need this as developers can compose the options after the call to builder.AddSqlServerDbContext<TContext>();.

cc @AndriySvyryd

@AndriySvyryd
Copy link
Copy Markdown
Member

The additional overload isn't present by design. See #4115 (comment).

@Juulsn
Copy link
Copy Markdown
Author

Juulsn commented Jul 8, 2024

Just found out about the enrich methods and definitely do agree with the design choice.

Would be great if the documentation could be a bit improve in this subject :)

In EntityFramework.Core 9.0, we've fixed composability of DbContextOptions

Awesome!

@github-actions github-actions Bot locked and limited conversation to collaborators Aug 8, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-integrations Issues pertaining to Aspire Integrations packages community-contribution Indicates that the PR has been added by a community member

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants