Obsolete {FromSql,ExecuteSql}Interpolated#37576
Merged
roji merged 1 commit intodotnet:mainfrom Feb 3, 2026
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This pull request obsoletes the FromSqlInterpolated and ExecuteSqlInterpolated methods in favor of the newer FromSql and ExecuteSql methods. These method pairs are functionally identical (both accept FormattableString), and the PR aims to simplify the API surface by steering users toward the preferred naming convention.
Changes:
- Added
[Obsolete]attributes toFromSqlInterpolated,ExecuteSqlInterpolated, andExecuteSqlInterpolatedAsyncmethods with clear guidance to use the newer alternatives - Updated test code throughout the codebase to use the new method names
- Added pragma warnings around tests that specifically verify behavior of the obsolete methods
- Updated code comments that referenced the obsolete method names
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/EFCore.Relational/Extensions/RelationalQueryableExtensions.cs | Added [Obsolete] attribute to FromSqlInterpolated<TEntity> method |
| src/EFCore.Relational/Extensions/RelationalDatabaseFacadeExtensions.cs | Added [Obsolete] attributes to ExecuteSqlInterpolated and ExecuteSqlInterpolatedAsync methods |
| src/EFCore/Query/Internal/ExpressionTreeFuncletizer.cs | Updated comment to reference FromSql() instead of obsolete method |
| src/EFCore.Analyzers/InterpolatedStringUsageInRawQueriesCodeFixProvider.cs | Updated comment to reference FromSql instead of obsolete method |
| test/EFCore.SqlServer.FunctionalTests/Query/AdHocMiscellaneousQuerySqlServerTest.cs | Updated test to use FromSql instead of obsolete method |
| test/EFCore.Relational.Specification.Tests/Query/SqlExecutorTestBase.cs | Updated tests to use ExecuteSql/ExecuteSqlAsync instead of obsolete methods |
| test/EFCore.Relational.Specification.Tests/Query/FromSqlQueryTestBase.cs | Updated tests to use FromSql instead of obsolete method |
| test/EFCore.Relational.Specification.Tests/Query/Inheritance/TPTInheritanceQueryTestBase.cs | Added pragma warnings around test that verifies obsolete method behavior |
| test/EFCore.Relational.Specification.Tests/Query/Inheritance/TPCInheritanceQueryTestBase.cs | Added pragma warnings around test that verifies obsolete method behavior |
| test/EFCore.CrossStore.FunctionalTests/QueryTest.cs | Added pragma warnings around test that verifies obsolete method behavior |
AndriySvyryd
approved these changes
Feb 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #37575