Skip to content

Conversation

@cincuranet
Copy link
Contributor

@cincuranet cincuranet commented Sep 10, 2025

Fixes #35244.

Description

I EF 9 we introduced UseAzureSql and UseAzureSynapse to allow target translations where these differ from generic SQL Server. These added new builders without common base class making it difficult to have extension methods for registering additional functions on all builders.

Customer impact

Customers cannot use i.e. UseNetTopologySuite with UseAzureSql.

How found

Customer reported.

Regression

Yes. From 9.

Testing

Tests added.

Risk

Low. This only adds base class, no other code changes.

@cincuranet cincuranet force-pushed the nts branch 6 times, most recently from 122c06f to 650c20b Compare September 11, 2025 08:58
@cincuranet cincuranet marked this pull request as ready for review September 11, 2025 08:58
@cincuranet cincuranet requested a review from a team as a code owner September 11, 2025 08:58
@cincuranet cincuranet requested a review from Copilot September 11, 2025 08:58
Copy link

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 introduces a common base class SqlEngineDbContextOptionsBuilderBase to unify SQL Server, Azure SQL, and Azure Synapse database context option builders, enabling extension methods to work across all three builders.

Key changes:

  • Creates a new base class that all SQL engine builders inherit from
  • Updates existing builders to inherit from the new base class instead of directly from RelationalDbContextOptionsBuilder
  • Modifies the NetTopologySuite extension to use generic constraints for broader compatibility

Reviewed Changes

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

Show a summary per file
File Description
SqlEngineDbContextOptionsBuilderBase.cs New base class providing common functionality for SQL engine builders
SqlServerDbContextOptionsBuilder.cs Updated to inherit from the new base class
SqlEngineDbContextOptionsBuilder.cs Updated to inherit from the new base class
AzureSynapseDbContextOptionsBuilder.cs Updated to inherit from the new base class
AzureSqlDbContextOptionsBuilder.cs Updated to inherit from the new base class
SqlServerNetTopologySuiteDbContextOptionsBuilderExtensions.cs Modified to use generic constraint for broader compatibility
SqlServerNetTopologySuiteCodeGeneratorPlugin.cs Updated method reflection to handle generic method
AzureSqlDbContextOptionsExtensionsTest.cs Added test to verify NetTopologySuite works with UseAzureSql

@cincuranet cincuranet force-pushed the nts branch 2 times, most recently from 6ee25c9 to e21403b Compare September 11, 2025 10:02
@AndriySvyryd AndriySvyryd changed the title Introduce SqlEngineDbContextOptionsBuilderBase to allow unified registration of extension over SQL Server, Azure SQL and Synapse. [rc2] Introduce SqlEngineDbContextOptionsBuilderBase to allow unified registration of extension over SQL Server, Azure SQL and Synapse. Sep 12, 2025
…tration of extension over SQL Server, Azure SQL and Synapse.

* Updates SqlServerNetTopologySuiteDbContextOptionsBuilderExtensions to use it.
* Updates SqlServerHierarchyIdDbContextOptionsBuilderExtensions to use it.
Copy link
Member

@artl93 artl93 left a comment

Choose a reason for hiding this comment

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

RC2

@cincuranet cincuranet merged commit 8d817c7 into dotnet:release/10.0 Sep 15, 2025
7 checks passed
@cincuranet cincuranet deleted the nts branch September 15, 2025 11:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add UseNetTopologySuite extension method for AzureSqlDbContextOptionsBuilder

3 participants