Dynamic Routing
Dynamic Routing describes the custom way DCMS menu records identify and direct visitors to destinations. It is an application-level design built on top of the web framework; it is not a replacement for standard ASP.NET Core request routing. ASP.NET Core receives a URL and selects a Razor handler. DCMS uses a menu item’s RouteType and RouteTarget to decide what that selection means for the application.
The four route types
The current RouteType lookup contains four values:
| Code | Destination | Example RouteTarget |
|---|---|---|
| V | Select a visitor experience. | /visitor?target=Patient |
| C | Open a content document by its ContentDocumentID. | /content?target=18 |
| P | Open an application page. | /page?target=clinicfinder.cshtml |
| R | Follow an internal or external redirect. | /redirect?target=https://example.org/ |
What the route fields mean
| Field | Purpose |
|---|---|
MenuItemID | Identifies one item in the menu. |
ParentMenuItemID | Connects a child item to its parent and establishes menu hierarchy. |
RouteType | Classifies the destination as Visitor, Content, Page, or Redirect. |
RouteTarget | Stores the route value the application follows. For content, it includes the endpoint and target identifier. |
ContentDocumentID | Identifies a content document. It is distinct from the menu item ID and from the complete route string. |
These values are related but not interchangeable. For example, a content route’s RouteTarget may be /content?target=18; the value 18 is the document identifier carried by that route.
How a menu selection is handled
- DCMS selects the menu item for the current menu and visitor experience.
- The menu item supplies its
RouteTypeand storedRouteTarget. - The application handler interprets the target according to the route type.
- For a content route, the content handler loads the
ContentDocumentidentified by the target and reads its content elements.
The stored target is used to create the link. The destination handler is responsible for validating and interpreting its parameters. A menu’s VisitorMask controls which menu items are shown for a selected visitor experience; it is not an authorization boundary for private information.
Content identity does not depend on titles
DCMS uses identifiers instead of looking up content by its visible menu title. Titles can be repeated for different visitor experiences or changed later. A menu item has its own MenuItemID; its associated content document has a separate ContentDocumentID.
For a content menu item, the database can create a placeholder ContentDocument linked to the menu item and use that document’s ID in the content route before the article has been written. A placeholder establishes the relationship; it is not authored or published PG information.
Menu routing and standard web routing
Standard web routing matches an incoming request URL to an application endpoint. The DCMS route model adds meaning to database-driven menu selections: the route type classifies the destination and the route target tells the application what to handle.
Menu hierarchy is established by parent and child relationships. The route type describes where a selection leads; it does not describe how a menu expands on screen.