Repository navigation
Preserve view comments during scaffolding - #39265
Conversation
- 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
There was a problem hiding this comment.
🟢 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.
Code coverage overviewLanguages: C# C# / code-coverage
View coverage of the 10 most impacted files.
ℹ️ Calculations represent line coverage. Results may change as calculations are updated. |
AndriySvyryd
left a comment
There was a problem hiding this comment.
Thanks for your contribution! 😄
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 |
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
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.