Skip to content

[rc2] Remove EFOptimizeContext property from EF targets#36650

Closed
Copilot wants to merge 2 commits intorelease/10.0from
copilot/fix-35079
Closed

[rc2] Remove EFOptimizeContext property from EF targets#36650
Copilot wants to merge 2 commits intorelease/10.0from
copilot/fix-35079

Conversation

Copy link
Contributor

Copilot AI commented Aug 25, 2025

This change removes the EFOptimizeContext MSBuild property from Entity Framework Core's build targets, as the existing EFScaffoldModelStage and EFPrecompileQueriesStage properties provide sufficient control over code generation.

Changes Made

Microsoft.EntityFrameworkCore.Tasks.targets:

  • Removed EFOptimizeContext conditions from _EFGenerateFilesAfterBuild and _EFGenerateFilesBeforePublish targets
  • Updated documentation comments to reflect that stage properties are the primary control mechanism

PACKAGE.md:

  • Updated usage instructions to focus on stage properties instead of EFOptimizeContext
  • Provided clearer guidance on controlling when code generation occurs

RootCommand.cs:

  • Modified dotnet ef dbcontext optimize command to disable generation using stage properties (/p:EFScaffoldModelStage=none /p:EFPrecompileQueriesStage=none) instead of /p:EFOptimizeContext=false

Impact

This is a simplification that removes a redundant control mechanism. Users can still control when Entity Framework code optimization occurs, but now exclusively through the more granular stage properties:

  • EFScaffoldModelStage=build|publish|none - Controls compiled model generation
  • EFPrecompileQueriesStage=build|publish|none - Controls precompiled query generation

The default behavior remains unchanged - both features are enabled for the publish stage by default.

Fixes #35079.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Co-authored-by: AndriySvyryd <6539701+AndriySvyryd@users.noreply.github.com>
Copilot AI changed the title [WIP] Remove EFOptimizeContext property from EF targets Remove EFOptimizeContext property from EF targets Aug 25, 2025
Copilot AI requested a review from AndriySvyryd August 25, 2025 23:20
@AndriySvyryd AndriySvyryd changed the title Remove EFOptimizeContext property from EF targets [rc2] Remove EFOptimizeContext property from EF targets Aug 25, 2025
@roji roji deleted the copilot/fix-35079 branch January 5, 2026 17:07
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.

Remove EFOptimizeContext property from EF targets

2 participants