INavigationRouteMap interface

Namespace Runic.Navigation in Runic.Navigation 0.23.0

public interface INavigationRouteMap

Maps route paths, such as customers/42/invoices/7, to navigation targets, and the entries of a region back to their route paths. RunicNavigator.GetPath and RunicNavigator.RestoreAsync use it to save and rebuild navigation, and NavigationRegion.OpenRouteAsync to open a deep link.

Remarks

NavigationRouteMap is the implementation that NavigationRouteServiceCollectionExtensions.AddRunicNavigationRoutes registers. Route paths are untrusted input when they come from a link, a notification or an address bar: a map creates only the targets it declares, from typed values.

Methods

CreateTarget

INavigationTarget<object>? CreateTarget(NavigationRegion region, string route)

Creates a target for route whose content region can present, or returns null when no route matches. Creating a target constructs no content.

Parameters

region

The region the target is for; its NavigationRegion.ContentType must accept the content.

route

A route path, with or without a leading /.

GetRoute

string? GetRoute(NavigationEntry entry)

Gets the route path of entry, or null when no route describes it.

Parameters

entry

An entry of a region of any navigator.