Skip to content

Preserve view comments during scaffolding - #39265

Merged
roji merged 1 commit into
mainfrom
roji-scaffolding-view-comments
Oct 15, 2026
Merged

roji merged 1 commit into
mainfrom
roji-scaffolding-view-comments

Conversation

@roji

@roji roji commented Oct 15, 2026

Copy link
Copy Markdown
Member

Scaffolding drops view-level comments because comment assignment runs only for tables. Apply the comment to entity metadata after the table/view mapping branch so the existing generators preserve it in entity XML summaries and model configuration.

Adds database-independent end-to-end regression coverage with and without data annotations, verifying comment preservation through generated-code compilation without introducing a table mapping.

Fixes: #39264

  • I've read the guidelines for contributing and seen the walkthrough
  • I've posted a comment on an issue with a detailed description of how I am planning to contribute and got approval from a member of the team
  • The code builds and tests pass locally (also verified by our automated build checks)
  • Commit messages follow this format:
        Summary of the changes
        - Detail 1
        - Detail 2

        Fixes #bugnumber
  • Tests for the changes have been added (for bug fixes / features)
  • Code follows the same patterns and style as existing code in this repo

Validation: . ./activate.sh && dotnet test test/EFCore.Design.Tests/EFCore.Design.Tests.csproj -- --filter-class '*RelationalScaffoldingModelFactoryTest' --filter-class '*CSharpDbContextGeneratorTest' --filter-class '*CSharpEntityTypeGeneratorTest' passed all 162 tests. Both new regression cases failed before the fix. Full-suite and CI validation have not been run.

- Apply comments to scaffolded entities for both tables and views
- Add end-to-end regression coverage with and without data annotations

Fixes #39264

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: eb729aa2-722d-4754-8394-74765f803e1f
Copilot AI balanced review requested due to automatic review settings October 15, 2026 13:35
@roji
roji requested a review from a team as a code owner October 15, 2026 13:35
@roji
roji enabled auto-merge (squash) October 15, 2026 13:36

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

The localized fix preserves table behavior and includes focused regression coverage, with no unresolved findings.

0 open findings

What changed in this PR

Preserves view-level comments in the shared scaffolding pipeline, addressing #39264.

Changes:

  • Applies comments after table/view mapping so both retain their metadata.
  • Adds regression coverage for generated documentation, configuration, and compiled models in both annotation modes, without introducing table mappings.
File Description
test/​EFCore.Design.Tests/​Scaffolding/​Internal/​CSharpDbContextGeneratorTest.cs Tests view comment preservation through code generation and compilation.
src/​EFCore.Design/​Scaffolding/​Internal/​RelationalScaffoldingModelFactory.cs Preserves comments for both tables and views.

🧠 Review effort: Balanced


💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

@github-code-quality

Copy link
Copy Markdown

Code coverage overview

Languages: C#

C# / code-coverage

main 891487c roji-scaffolding-vie... 6b73766 +/-
76% 76% 0%
View coverage of the 10 most impacted files.
File main 891487c roji-scaffolding-vie... 6b73766 +/-
src/EFCore.Rela...CommandCache.cs 100% 98% -2%
src/EFCore.Desi...ModelFactory.cs 90% 89% -1%
src/EFCore.Rela...alConnection.cs 93% 93% 0%
src/EFCore.Cosm...erExtensions.cs 100% 100% 0%
src/EFCore.Cosm...erExtensions.cs 46% 46% 0%
src/EFCore.Cosm...peExtensions.cs 73% 73% 0%
src/EFCore.Cosm...StreamHelper.cs 87% 87% 0%
src/EFCore.Cosm...delValidator.cs 98% 98% 0%
src/EFCore.Cosm...orConvention.cs 94% 94% 0%
src/Shared/NonC...yInitializer.cs 11% 12% +1%

ℹ️ Calculations represent line coverage. Results may change as calculations are updated.

@AndriySvyryd AndriySvyryd left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for your contribution! 😄

@roji
roji merged commit 8ff6537 into main Oct 15, 2026
24 checks passed
@roji
roji deleted the roji-scaffolding-view-comments branch October 15, 2026 18:48
@Varorbc

Varorbc commented Oct 16, 2026

Copy link
Copy Markdown
Contributor

Thanks for your contribution! 😄

Does this mean that @roji has left the EF Core team?

@AndriySvyryd

Copy link
Copy Markdown
Member

Does this mean that @roji has left the EF Core team?

https://github.com/dotnet/efcore/graphs/contributors?from=4%2F18%2F2026 paints a rather clear picture

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.

Scaffolding drops view-level comments

4 participants