Navigation services uses different providers to get source navigation data. For example: JSON, XML file, Database, or something else.
You can create custom navigation provider:
publicclassCustomNavigationProvider<TNavigationItem> :INavigationProvider<TNavigationItem>whereTNavigationItem:NavigationItem<TNavigationItem>,new(){publicIEnumerable<TNavigationItem> CreateNavigation() {/* Do some logic here */ }}
When you setup navigation provider you can configure navigation options represents by NavigationOptions<TNavigationItem>.
NavigationOptions<TNavigationItem> properties:
Example configure navigation services:
services.AddNavigation() .AddJson<MenuItem>("path_to_json_file", (serviceProvider, options) => { options.ResourceType = typeof(MenuResource); // Also navigation item should have configured `ResourceName` property.
options.ItemFilter= item =>serviceProvider.GetService<IMenuFilter>().Filter(item);options.ItemActivator= item =>serviceProvider.GetService<IMenuActivator>().Activate(item); });
Usage
Navigation services uses to organize menu or breadcrumbs. Both of navigation elements should be inherited from NavigationItem<T> that represents basic navigation item.