Table of Contents

Class RouteParameter

Namespace
Blazing.Mvvm.Components.Routing
Assembly
Blazing.Mvvm.dll

Represents metadata for a route parameter extracted from a route template pattern.

public sealed class RouteParameter

Inheritance

Remarks

Route parameters are defined within curly braces in route templates and can have various modifiers:

  • {name} - Required parameter
  • {name?} - Optional parameter
  • {*name} - Catch-all parameter
  • {name:constraint} - Constrained parameter (e.g., int, guid, regex)

Properties

Constraint

Gets the constraint applied to this parameter, if any.

public string? Constraint { get; init; }

Property Value

string?

Examples

For {id:int}, the Constraint value would be "int". For {sku:regex(^[A-Z]{3}-\d{4}\()}</code>, the Constraint value would be "regex(^[A-Z]{3}-\\d{4}\))".

Remarks

Constraints specify the data type or format expected for the parameter. Examples: "int", "guid", "regex(^[A-Z]{3}-\d{4}$)"

IsCatchAll

Gets a value indicating whether this parameter is a catch-all parameter.

public bool IsCatchAll { get; init; }

Property Value

bool

Remarks

Catch-all parameters are denoted by an asterisk: {*name} They capture the remainder of the URL path.

IsOptional

Gets a value indicating whether this parameter is optional.

public bool IsOptional { get; init; }

Property Value

bool

Remarks

Optional parameters are denoted by a question mark: {name?}

Name

Gets the name of the route parameter.

public required string Name { get; init; }

Property Value

string

Examples

For the route template /users/{userId}/posts/{postId}, the names would be "userId" and "postId".