Skip to content

Validate Dynamic Route Values #11536

@rynowak

Description

@rynowak

Summary

Background: #4221
PR: #8955

It's super common in the older versions of MVC to subclass Route and implement dynamic generation of route values (usually using a database).

Ex:

  1. Write a route like product}/{**slug}
  2. Store the mapping between product slugs and controller/action route values in a database
  3. Implement an IRouter that does a database lookup

The key of this is that the user doesn't really write any significant routing functionality, they just want to map a parameter to a controller/action

Checklist

Example: https://github.com/aspnet/AspNetCore/pull/8955/files#diff-5a433b2664ee6b8ae7b9717bc51d3518

  • Can write a DynamicRouteValueTransformer for controllers
  • Can write a DynamicRouteValueTransformer for pages
  • Can still use policies like [Host] or [Consumes] in conjunction with this feature

Metadata

Metadata

Assignees

Labels

DoneThis issue has been fixedValidationThis issue is used to track validation effortsarea-mvcIncludes: MVC, Actions and Controllers, Localization, CORS, most templates

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions