-
Notifications
You must be signed in to change notification settings - Fork 3.3k
[rc2] Introduce SqlEngineDbContextOptionsBuilderBase to allow unified registration of extension over SQL Server, Azure SQL and Synapse. #36737
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
122c06f to
650c20b
Compare
There was a problem hiding this 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 |
src/EFCore.SqlServer.NTS/Scaffolding/Internal/SqlServerNetTopologySuiteCodeGeneratorPlugin.cs
Outdated
Show resolved
Hide resolved
6ee25c9 to
e21403b
Compare
src/EFCore.SqlServer.NTS/Scaffolding/Internal/SqlServerNetTopologySuiteCodeGeneratorPlugin.cs
Show resolved
Hide resolved
...FCore.SqlServer.NTS/Extensions/SqlServerNetTopologySuiteDbContextOptionsBuilderExtensions.cs
Show resolved
Hide resolved
…tration of extension over SQL Server, Azure SQL and Synapse. * Updates SqlServerNetTopologySuiteDbContextOptionsBuilderExtensions to use it. * Updates SqlServerHierarchyIdDbContextOptionsBuilderExtensions to use it.
artl93
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
RC2
Fixes #35244.
Description
I EF 9 we introduced
UseAzureSqlandUseAzureSynapseto 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.
UseNetTopologySuitewithUseAzureSql.How found
Customer reported.
Regression
Yes. From 9.
Testing
Tests added.
Risk
Low. This only adds base class, no other code changes.