Class SitecoreComponentViewComponent
Version: 21.x
Default view with model binding to render components.
Inherited Members
Namespace: Sitecore.AspNet.RenderingEngine.ViewComponents
Assembly: Sitecore.AspNet.RenderingEngine.dll
Syntax
RequestResponse
public class SitecoreComponentViewComponent : BindingViewComponentConstructors
SitecoreComponentViewComponent(IViewModelBinder)
Initializes a new instance of the SitecoreComponentViewComponent class.
Declaration
RequestResponse
public SitecoreComponentViewComponent(IViewModelBinder binder)Parameters
| Type | Name | Description |
|---|---|---|
| IViewModelBinder | binder |
The IViewModelBinder to use when binding the model to the view component. |
Methods
InvokeAsync(Type, String)
Executes the view component.
Declaration
RequestResponse
public Task<IViewComponentResult> InvokeAsync(Type modelType, string viewName)Parameters
| Type | Name | Description |
|---|---|---|
| System.Type | modelType |
The type of the model to use when generating the view component output. |
| System.String | viewName |
The name of the view to use when generating the view component output. |
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task<Microsoft.AspNetCore.Mvc.IViewComponentResult> |
A System.Threading.Tasks.Task<> representing the result of the asynchronous operation. |