Skip to content

Remove pre-v11 obsolete APIs#38145

Open
roji wants to merge 3 commits intomainfrom
roji/remove-pre-v11-obsolete-apis
Open

Remove pre-v11 obsolete APIs#38145
roji wants to merge 3 commits intomainfrom
roji/remove-pre-v11-obsolete-apis

Conversation

@roji
Copy link
Copy Markdown
Member

@roji roji commented Apr 20, 2026

Remove all APIs marked [Obsolete] that were obsoleted before v11 (i.e. they existed as obsolete in the release/10.0 branch). APIs obsoleted only in v11 (main) are preserved.

Changes

~57 APIs removed across 8 projects:

  • EFCore: AutoTransactionsEnabled, EntityFrameworkEventSource, IEntityTypeIgnoredConvention, DeclaringEntityType DIMs, GetQueryFilter(), RuntimeModel parameterless ctor, ValueGeneratorFactory from CoreTypeMapping/ConverterMappingHints, ITypeMappingSource.FindMapping(MemberInfo), IValueGeneratorSelector.Select()/Create(), IConstructorBindingFactory.TryBindConstructor overloads, EntityMaterializerSourceParameters, IEntityMaterializerSource, etc.
  • EFCore.Relational: CommandSource.BulkUpdate, ContainerColumnTypeMapping, container column mapping extensions, TranslateParameterizedCollectionsToConstants/Parameters, obsolete Optimize(), SqlConstantExpression old ctor, TypeMappingSource from command builder deps, etc.
  • Providers: IsMemoryOptimized (SqlServer), UseAzureSqlDefaults, SqliteLegacyUpdateSqlGenerator (deleted file), InMemoryValueGeneratorSelector.Select(), Cosmos partition key singular methods, MigrationsCodeGeneratorDependencies.RelationalTypeMappingSource, IModelCodeGeneratorSelector.Select(string?)

Preserved (v11-only or DO NOT REMOVE)

  • CosmosEventId.SyncNotSupported, ContentResponseOnWrite, ExecuteSqlCommand, FromSqlInterpolated, ToJson overloads, JsonTypeMapping, Sequence methods, check constraint/comment builder extensions, platform serialization GetObjectData methods

Test updates

  • Removed/updated tests referencing removed APIs across 15 test files
  • API baselines updated for all affected projects

Remove all APIs marked [Obsolete] that were obsoleted before v11 (i.e.
they existed as obsolete in the release/10.0 branch). APIs obsoleted only
in v11 (main) are preserved.

~57 APIs removed across EFCore, EFCore.Relational, EFCore.Abstractions,
EFCore.SqlServer, EFCore.Sqlite, EFCore.InMemory, EFCore.Cosmos, and
EFCore.Design. Includes cascade fixes (constructor params, test updates,
pragma cleanup) and updated API baselines.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@roji roji force-pushed the roji/remove-pre-v11-obsolete-apis branch from c3dd84f to 8e52e3b Compare April 20, 2026 10:00
Comment thread src/EFCore.Relational/Design/AnnotationCodeGenerator.cs Outdated
@roji roji marked this pull request as ready for review April 20, 2026 10:07
@roji roji requested a review from a team as a code owner April 20, 2026 10:07
Copilot AI review requested due to automatic review settings April 20, 2026 10:07
@roji
Copy link
Copy Markdown
Member Author

roji commented Apr 20, 2026

@AndriySvyryd there's various obsoletions in areas you're more familiar with; take a look to make sure it all looks sane. Feel free to push to this PR directly with any changes.

Copy link
Copy Markdown

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

Removes legacy EF Core APIs that were marked [Obsolete] prior to v11, and updates tests + API baselines accordingly to keep the codebase aligned with the supported surface area.

Changes:

  • Removed pre-v11 obsolete APIs across EFCore, EFCore.Relational, EFCore.SqlServer, EFCore.InMemory, EFCore.Design, EFCore.Cosmos and EFCore.Abstractions.
  • Updated call sites/tests to use the non-obsolete replacements (e.g., TrySelect, new RuntimeModel ctor, UseAzureSql, partition key plural APIs).
  • Updated API baseline JSON files to reflect the removals.

Reviewed changes

Copilot reviewed 77 out of 79 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
test/EFCore.Tests/ValueGeneration/ValueGeneratorSelectorTest.cs Removes tests for obsolete Select() and uses TrySelect() only.
test/EFCore.Tests/Metadata/Internal/ClrPropertySetterFactoryTest.cs Drops obsolete DeclaringEntityType shim usage in test fake.
test/EFCore.Tests/Metadata/Internal/ClrPropertyGetterFactoryTest.cs Drops obsolete DeclaringEntityType shim usage in test fake.
test/EFCore.Tests/Metadata/Conventions/IndexAttributeConventionTest.cs Removes test coverage for removed obsolete IndexAttribute ctor usage.
test/EFCore.Tests/Infrastructure/CompiledModelProviderMismatchTest.cs Updates for removed RuntimeModel parameterless ctor.
test/EFCore.SqlServer.Tests/ValueGeneration/SqlServerValueGeneratorSelectorTest.cs Removes tests for obsolete Select() and uses TrySelect() only.
test/EFCore.SqlServer.FunctionalTests/TestUtilities/TestRelationalCommandBuilderFactory.cs Removes obsolete TypeMappingSource exposure from test builder.
test/EFCore.SqlServer.FunctionalTests/SqlServerConfigPatternsTest.cs Updates obsolete Azure SQL configuration pattern usage.
test/EFCore.SqlServer.FunctionalTests/ModelBuilding/SqlServerModelBuilderTestBase.cs Removes assertions using obsolete container column type mapping API.
test/EFCore.Relational.Specification.Tests/TransactionTestBase.cs Removes test for obsolete AutoTransactionsEnabled.
test/EFCore.InMemory.Tests/ValueGeneration/InMemoryValueGeneratorSelectorTest.cs Removes tests for obsolete Select() and uses TrySelect() only.
test/EFCore.Design.Tests/Migrations/Design/MigrationScaffolderTest.cs Updates for removed obsolete migrations dependencies.
test/EFCore.Design.Tests/Migrations/Design/CSharpMigrationsGeneratorTest.cs Updates annotation lists and dependencies after obsolete removals.
test/EFCore.Design.Tests/Migrations/Design/CSharpMigrationsGeneratorTest.ModelSnapshot.cs Updates for removed obsolete migrations dependencies.
test/EFCore.Design.Tests/Migrations/Design/CSharpMigrationsGeneratorSqliteTest.cs Updates for removed obsolete migrations dependencies.
test/EFCore.Cosmos.Tests/Extensions/CosmosMetadataExtensionsTest.cs Migrates partition key tests to plural partition key APIs.
test/EFCore.Cosmos.Tests/Extensions/CosmosBuilderExtensionsTest.cs Migrates builder tests to plural partition key APIs.
test/EFCore.Cosmos.FunctionalTests/ModelBuilding/CosmosModelBuilderGenericTest.cs Removes assertions using obsolete singular partition key APIs.
src/EFCore/ValueGeneration/ValueGeneratorSelector.cs Removes obsolete Select()/Create() methods and obsolete mapping fallback.
src/EFCore/ValueGeneration/IValueGeneratorSelector.cs Removes obsolete Select() API from interface.
src/EFCore/Storage/ValueConversion/Internal/StringGuidConverter.cs Updates converter mapping hints usage after factory hint removal.
src/EFCore/Storage/ValueConversion/GuidToBytesConverter.cs Updates converter mapping hints usage after factory hint removal.
src/EFCore/Storage/ValueConversion/ConverterMappingHints.cs Removes obsolete ValueGeneratorFactory support from hints API.
src/EFCore/Storage/TypeMappingSourceBase.cs Updates docs for remaining FindMapping(MemberInfo) shape.
src/EFCore/Storage/ITypeMappingSource.cs Removes obsolete FindMapping(MemberInfo) overload (without IModel).
src/EFCore/Storage/CoreTypeMapping.cs Removes obsolete ValueGeneratorFactory exposure.
src/EFCore/Query/ParameterQueryRootExpression.cs Removes obsolete constructors and obsolete ParameterExpression property.
src/EFCore/Query/Internal/NavigationExpandingExpressionVisitor.cs Removes throw path that referenced removed obsolete string resource.
src/EFCore/Properties/CoreStrings.Designer.cs Removes obsolete string resource accessor.
src/EFCore/Metadata/RuntimeModel.cs Removes obsolete parameterless ctor and obsolete setters.
src/EFCore/Metadata/RuntimeEntityType.cs Removes obsolete query filter accessor.
src/EFCore/Metadata/Internal/Model.cs Removes obsolete IConventionModel.AddEntityType DIMs.
src/EFCore/Metadata/Internal/EntityType.cs Removes obsolete GetQueryFilter() method.
src/EFCore/Metadata/Internal/ConstructorBindingFactory.cs Removes obsolete TryBindConstructor overloads.
src/EFCore/Metadata/IReadOnlyProperty.cs Removes obsolete DeclaringEntityType DIM.
src/EFCore/Metadata/IReadOnlyEntityType.cs Removes obsolete GetQueryFilter() API.
src/EFCore/Metadata/IProperty.cs Removes obsolete DeclaringEntityType DIM.
src/EFCore/Metadata/IMutableProperty.cs Removes obsolete DeclaringEntityType DIM.
src/EFCore/Metadata/IConventionProperty.cs Removes obsolete DeclaringEntityType DIM.
src/EFCore/Metadata/IConventionModel.cs Removes obsolete owned-entity defining-navigation AddEntityType overloads.
src/EFCore/Metadata/IConstructorBindingFactory.cs Removes obsolete TryBindConstructor APIs.
src/EFCore/Infrastructure/DatabaseFacade.cs Removes obsolete AutoTransactionsEnabled property.
src/EFCore/Infrastructure/AnnotatableBuilder.cs Removes obsolete RemoveAnnotation() in favor of HasNoAnnotation().
src/EFCore/EFCore.baseline.json Updates API baseline for removed/changed members.
src/EFCore/Diagnostics/CoreEventId.cs Removes obsolete event id field.
src/EFCore.SqlServer/ValueGeneration/Internal/SqlServerValueGeneratorSelector.cs Removes obsolete Select() override.
src/EFCore.SqlServer/Infrastructure/SqlServerDbContextOptionsBuilder.cs Removes obsolete UseAzureSqlDefaults().
src/EFCore.SqlServer/Extensions/SqlServerEntityTypeBuilderExtensions.cs Removes obsolete IsMemoryOptimized() extension methods.
src/EFCore.SqlServer/EFCore.SqlServer.baseline.json Updates API baseline for removed/changed members.
src/EFCore.Relational/Storage/ValueConversion/RelationalConverterMappingHints.cs Removes obsolete value-generator-factory hint plumbing.
src/EFCore.Relational/Storage/RelationalCommandBuilderExtensions.cs Removes obsolete AddParameter overload.
src/EFCore.Relational/Storage/RelationalCommandBuilderDependencies.cs Removes obsolete TypeMappingSource dependency exposure.
src/EFCore.Relational/Storage/RelationalCommandBuilder.cs Removes obsolete TypeMappingSource property.
src/EFCore.Relational/Storage/IRelationalTypeMappingSource.cs Adjusts FindMapping(MemberInfo) signature to no longer hide removed base overload.
src/EFCore.Relational/Storage/IRelationalCommandBuilder.cs Removes obsolete TypeMappingSource from interface.
src/EFCore.Relational/Query/SqlExpressions/SqlConstantExpression.cs Removes obsolete constructor overload.
src/EFCore.Relational/Query/RelationalQueryableMethodTranslatingExpressionVisitor.cs Removes obsolete nested inferred type mapping applier type.
src/EFCore.Relational/Query/RelationalQueryableMethodTranslatingExpressionVisitor.ExecuteDelete.cs Removes obsolete overload marked error:true.
src/EFCore.Relational/Query/RelationalParameterBasedSqlProcessor.cs Removes obsolete Optimize() API marked error:true.
src/EFCore.Relational/Query/CollectionResultExpression.cs Removes obsolete members marked error:true.
src/EFCore.Relational/Properties/RelationalStrings.Designer.cs Updates string resource surface in line with obsolete removals.
src/EFCore.Relational/Metadata/RelationalAnnotationNames.cs Removes obsolete container column type mapping annotation name constant.
src/EFCore.Relational/Metadata/IStoreFunctionParameter.cs Removes obsolete Type alias property.
src/EFCore.Relational/Metadata/Conventions/RelationalMapToJsonConvention.cs Drops obsolete convention interface/method implementation.
src/EFCore.Relational/Infrastructure/RelationalDbContextOptionsBuilder.cs Removes obsolete parameterized collection translation APIs.
src/EFCore.Relational/Extensions/RelationalPropertyExtensions.cs Removes obsolete column base name helpers.
src/EFCore.Relational/Extensions/RelationalEntityTypeExtensions.cs Removes obsolete container column type mapping extensions.
src/EFCore.Relational/EFCore.Relational.baseline.json Updates API baseline for removed/changed members.
src/EFCore.Relational/Diagnostics/CommandSource.cs Removes obsolete BulkUpdate member and normalizes execute operation members.
src/EFCore.Relational/Design/AnnotationCodeGenerator.cs Updates ignored annotation handling after annotation name removal.
src/EFCore.InMemory/ValueGeneration/Internal/InMemoryValueGeneratorSelector.cs Removes obsolete Select() override.
src/EFCore.Design/Scaffolding/IModelCodeGeneratorSelector.cs Removes obsolete Select(string?) overload and default interface method forwarding.
src/EFCore.Design/Migrations/Design/MigrationsCodeGeneratorDependencies.cs Removes obsolete relational type mapping source dependency.
src/EFCore.Design/EFCore.Design.baseline.json Updates API baseline for removed/changed members.
src/EFCore.Cosmos/Extensions/CosmosEntityTypeExtensions.cs Removes obsolete singular partition key extension APIs.
src/EFCore.Cosmos/Extensions/CosmosEntityTypeBuilderExtensions.cs Removes obsolete singular partition key builder APIs.
src/EFCore.Cosmos/EFCore.Cosmos.baseline.json Updates API baseline for removed/changed members.
src/EFCore.Abstractions/IndexAttribute.cs Removes obsolete IndexAttribute(params string[]) ctor.
src/EFCore.Abstractions/EFCore.Abstractions.baseline.json Updates API baseline for removed/changed members.
Files not reviewed (2)
  • src/EFCore.Relational/Properties/RelationalStrings.Designer.cs: Language not supported
  • src/EFCore/Properties/CoreStrings.Designer.cs: Language not supported

Comment thread src/EFCore.Relational/Properties/RelationalStrings.Designer.cs Outdated
Comment thread src/EFCore.Relational/Design/AnnotationCodeGenerator.cs
Copy link
Copy Markdown
Member Author

@roji roji left a comment

Choose a reason for hiding this comment

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

@AndriySvyryd I manually went over all the obsoletions and checked when they were done; FWIW Copilot did not include anything post-10.

Comment thread src/EFCore.Abstractions/IndexAttribute.cs
Comment thread src/EFCore.Cosmos/Extensions/CosmosEntityTypeBuilderExtensions.cs
Comment thread src/EFCore.Cosmos/Extensions/CosmosEntityTypeExtensions.cs
Comment thread src/EFCore.Design/Scaffolding/IModelCodeGeneratorSelector.cs
Comment thread src/EFCore/Storage/CoreTypeMapping.cs
Comment thread src/EFCore/Storage/ITypeMappingSource.cs
Comment thread src/EFCore/ValueGeneration/IValueGeneratorSelector.cs
Comment thread src/EFCore/ValueGeneration/ValueGeneratorSelector.cs
Comment thread src/EFCore/ValueGeneration/ValueGeneratorSelector.cs
And restore Obsolete_NonDefiningInverseNavigationWarning
Comment thread src/EFCore.Cosmos/Diagnostics/CosmosEventId.cs
Copilot AI review requested due to automatic review settings April 22, 2026 19:58
Copy link
Copy Markdown

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

Copilot reviewed 82 out of 82 changed files in this pull request and generated 2 comments.

Comment on lines 16943 to 16945
{
"Member": "static string BadSequenceString { get; }",
"Stage": "Obsolete"
"Member": "static string BadSequenceString { get; }"
},
Copy link

Copilot AI Apr 22, 2026

Choose a reason for hiding this comment

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

In EFCore.Relational.baseline.json, RelationalStrings.BadSequenceString is listed without Stage="Obsolete", but the actual API is still marked [Obsolete] (see src/EFCore.Relational/Properties/RelationalStrings.Designer.cs and the .resx comment). This will likely cause EFCore.ApiBaseline.Tests to fail or incorrectly represent the public API. Either restore the Obsolete stage in the baseline entry, or remove the [Obsolete] designation from the string resource if it was meant to be de-obsoleted.

Copilot uses AI. Check for mistakes.
Comment on lines 431 to +444
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
=> optionsBuilder
.EnableServiceProviderCaching(false)
.UseSqlServer(
@"Server=test.database.windows.net:4040;Database=Test;ConnectRetryCount=0",
a =>
{
if (_useAzure)
{
#pragma warning disable CS0618 // Type or member is obsolete
a.UseAzureSqlDefaults(false);
#pragma warning restore CS0618 // Type or member is obsolete
}
});
{
optionsBuilder.EnableServiceProviderCaching(false);
if (_useAzure)
{
optionsBuilder.UseAzureSql(
@"Server=test.database.windows.net:4040;Database=Test;ConnectRetryCount=0");
}
else
{
optionsBuilder.UseSqlServer(
@"Server=test.database.windows.net:4040;Database=Test;ConnectRetryCount=0");
}
}
Copy link

Copilot AI Apr 22, 2026

Choose a reason for hiding this comment

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

Switching the Azure branch to optionsBuilder.UseAzureSql(...) changes the default execution strategy: SqlServerOptionsExtension.ApplyDefaults() enables SqlServerRetryingExecutionStrategy whenever EngineType is AzureSql. This means the test method above (Retry_on_failure_not_enabled_by_default_on_Azure_SQL) will no longer get SqlServerExecutionStrategy when _useAzure is true. Either update the assertion/name to expect the retrying strategy for AzureSql, or change the configuration to keep a non-retrying strategy when that behavior is what the test is validating.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants