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