Class ViewDataDictionaryExtensions
- Namespace
- Cuemon.Extensions.AspNetCore.Mvc
- Assembly
- Cuemon.Extensions.AspNetCore.Mvc.dll
Extension methods for the Microsoft.AspNetCore.Mvc.ViewFeatures.ViewDataDictionary class. Experimental.
public static class ViewDataDictionaryExtensions
- Inheritance
-
ViewDataDictionaryExtensions
Methods
AddBreadcrumbs<T>(ViewDataDictionary, Controller, T, Func<T, IEnumerable<String>>)
Adds a sequence of Breadcrumb objects to the specified viewData
.
public static void AddBreadcrumbs<T>(this ViewDataDictionary viewData, Controller controller, T model, Func<T, IEnumerable<string>> initializer)
Parameters
viewData
ViewDataDictionaryThe Microsoft.AspNetCore.Mvc.ViewFeatures.ViewDataDictionary to extend.
controller
ControllerThe controller to resolve all public methods with Microsoft.AspNetCore.Mvc.IActionResult as return type from.
model
TThe model to retrieve custom breadcrumb labels from.
initializer
Func<T, IEnumerable<String>>The function delegate that will initialize labels from the spcified
model
.
Type Parameters
T
The type of the model to retrieve breadcrumb labels from.
GetBreadcrumbs(ViewDataDictionary, IRazorPage)
Gets a sequence of Breadcrumb objects from the specified viewData
.
public static IEnumerable<Breadcrumb> GetBreadcrumbs(this ViewDataDictionary viewData, IRazorPage razor)
Parameters
viewData
ViewDataDictionaryThe Microsoft.AspNetCore.Mvc.ViewFeatures.ViewDataDictionary to extend.
razor
IRazorPageThe razor page from where the breadcrumbs will be rendered.
Returns
- IEnumerable<Breadcrumb>
An IEnumerable<T> sequence of Breadcrumb objects (if any).