Class RouteTemplate
- Namespace
- Blazing.Mvvm.Components.Routing
- Assembly
- Blazing.Mvvm.dll
Represents a parsed route template with its pattern and extracted parameter metadata.
public sealed class RouteTemplateInheritance
Remarks
This class encapsulates a route pattern string along with all route parameters found within it. It provides convenience properties for common queries about the route's structure.
Properties
HasCatchAll
Gets a value indicating whether this route template contains a catch-all parameter.
public bool HasCatchAll { get; }Property Value
Remarks
Catch-all parameters (denoted with *) capture the remainder of the URL path.
A route template can have at most one catch-all parameter, and it must be the last parameter.
ParameterCount
Gets the total number of parameters in this route template.
public int ParameterCount { get; }Property Value
Parameters
Gets the list of parameters extracted from the route pattern.
public required List<RouteParameter> Parameters { get; init; }Property Value
Remarks
Parameters are listed in the order they appear in the route pattern.
Pattern
Gets the original route pattern string.
public required string Pattern { get; init; }Property Value
Examples
Examples of route patterns:
/users- Simple route with no parameters/users/{userId}- Route with one required parameter/users/{userId?}- Route with one optional parameter/users/{userId}/posts/{postId}- Route with multiple parameters/docs/{*path}- Route with catch-all parameter
RequiredParameterCount
Gets the number of required (non-optional) parameters in this route template.
public int RequiredParameterCount { get; }Property Value
Remarks
This count excludes parameters marked as optional with the ? modifier.
Used for template selection to prefer routes with matching required parameter counts.