Skip to content

Conversation

@captainsafia
Copy link
Member

Contributes towards #5826.

Closes #7785.

Copilot AI review requested due to automatic review settings March 11, 2025 20:07
@github-actions github-actions bot added the area-integrations Issues pertaining to Aspire Integrations packages label Mar 11, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes named configuration handling for DbContext‐based clients by ensuring that connection-specific settings override general settings when provided. Key changes include:

  • Adding tests for various providers (Npgsql, Cosmos, MySql, SQL Server, and Oracle) to verify that connection names correctly apply configuration settings.
  • Updating extension methods in multiple components to support an optional connectionName parameter in the GetDbContextSettings helper.
  • Enhancing configuration resource injection for Azure CosmosDB to align with the new naming scheme.

Reviewed Changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
tests/Aspire.Npgsql.EntityFrameworkCore.PostgreSQL.Tests/AspireEFPostgreSqlExtensionsTests.cs Introduces tests for Npgsql that verify connection-specific settings.
tests/Aspire.Microsoft.EntityFrameworkCore.Cosmos.Tests/AspireAzureEfCoreCosmosDBExtensionsTests.cs Adds tests for Cosmos DB to ensure connection and context-specific settings behave as intended.
tests/Aspire.Pomelo.EntityFrameworkCore.MySql.Tests/AspireEFMySqlExtensionsTests.cs Implements tests for MySql verifying the application of connection-specific settings.
tests/Aspire.Microsoft.EntityFrameworkCore.SqlServer.Tests/AspireSqlServerEFCoreSqlClientExtensionsTests.cs Provides tests for SQL Server to confirm that context-specific settings take precedence.
tests/Aspire.Oracle.EntityFrameworkCore.Tests/AspireOracleEFCoreDatabaseExtensionsTests.cs Adds tests for Oracle to validate correct settings application.
src/Aspire.Hosting.Azure.CosmosDB/AzureCosmosDBResource.cs Updates resource configuration insertion for CosmosDB to support EF Core.
src/Components/Common/EntityFrameworkUtils.cs Modifies GetDbContextSettings to include an optional connectionName parameter and bind connection-specific settings.
src/Components/* Various provider-specific EF Core extension classes now pass connectionName or null appropriately to GetDbContextSettings.

Copy link
Member

@eerhardt eerhardt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks!

@captainsafia captainsafia merged commit 6c57229 into main Mar 13, 2025
158 of 160 checks passed
@captainsafia captainsafia deleted the cs/named-configure-providers branch March 13, 2025 16:35
@github-actions github-actions bot locked and limited conversation to collaborators Apr 13, 2025
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

AddAzureCosmosDB is not working with AddCosmosDbContext

4 participants