Skip to content

Merge endpoint metadata for dynamic endpoints.#67664

Open
cincuranet wants to merge 6 commits into
dotnet:mainfrom
cincuranet:dynamic-meta
Open

Merge endpoint metadata for dynamic endpoints.#67664
cincuranet wants to merge 6 commits into
dotnet:mainfrom
cincuranet:dynamic-meta

Conversation

@cincuranet

Copy link
Copy Markdown
Contributor

Fixes #66666.

@cincuranet
cincuranet marked this pull request as ready for review July 13, 2026 07:21
@cincuranet
cincuranet requested a review from a team as a code owner July 13, 2026 07:21
Copilot AI review requested due to automatic review settings July 13, 2026 07:21

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.

Pull request overview

This PR addresses #66666 by preserving metadata configured on dynamic/fallback endpoints when they are resolved into page/controller endpoints (via CandidateSet.ExpandEndpoint). This ensures metadata like authorization on the dynamic route isn’t dropped during endpoint expansion.

Changes:

  • Merge original dynamic endpoint metadata into resolved Razor Pages endpoints before expanding candidates.
  • Merge original dynamic endpoint metadata into resolved MVC controller endpoints before expanding candidates.
  • Add a shared DynamicEndpointMetadataMerger helper and expand test coverage for merged-metadata scenarios.

Reviewed changes

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

Show a summary per file
File Description
src/Mvc/Mvc.RazorPages/src/Infrastructure/DynamicPageEndpointMatcherPolicy.cs Merges dynamic endpoint metadata into resolved page endpoints (compiled and runtime-compiled).
src/Mvc/Mvc.Core/src/Routing/DynamicControllerEndpointMatcherPolicy.cs Merges dynamic endpoint metadata into resolved controller endpoints before expanding candidates.
src/Mvc/Mvc.Core/src/Routing/DynamicEndpointMetadataMerger.cs Introduces helper to clone endpoints with combined metadata at correct precedence.
src/Mvc/Mvc.RazorPages/test/Infrastructure/DynamicPageEndpointMatcherPolicyTest.cs Updates existing assertions (no longer reference-equality) and adds metadata-merge tests for pages.
src/Mvc/Mvc.Core/test/Routing/DynamicControllerEndpointMatcherPolicyTest.cs Updates existing assertions and adds metadata-merge tests for controllers.

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.

Dynamic endpoint discards the original endpoint's metadata

2 participants