Class BindingViewComponent
- Namespace
- Sitecore.AspNetCore.SDK.RenderingEngine.ViewComponents
- Assembly
- Sitecore.AspNetCore.SDK.RenderingEngine.dll
Provides delayed binding for a ViewComponent.
public abstract class BindingViewComponent : ViewComponent
- Inheritance
-
BindingViewComponent
- Derived
- Inherited Members
Constructors
BindingViewComponent(IViewModelBinder)
Initializes a new instance of the BindingViewComponent class.
protected BindingViewComponent(IViewModelBinder binder)
Parameters
binder
IViewModelBinderThe IViewModelBinder to enable binding.
Properties
Binder
Gets the instance of IViewModelBinder used for binding.
protected IViewModelBinder Binder { get; }
Property Value
Methods
BindView(Type, string)
Returns the specified view bound to the given model type.
public virtual Task<IViewComponentResult> BindView(Type modelType, string viewName)
Parameters
Returns
BindView<TModel>()
Returns the default view using a bound model of TModel
.
public virtual Task<IViewComponentResult> BindView<TModel>() where TModel : class, new()
Returns
Type Parameters
TModel
The model to be bound.
BindView<TModel>(string)
Returns the specified view using a bound model of TModel
.
public virtual Task<IViewComponentResult> BindView<TModel>(string viewName) where TModel : class, new()
Parameters
viewName
stringThe view to be returned.
Returns
Type Parameters
TModel
The model to be bound.
BindView<TModel>(string, TModel)
Returns the specified view bound to the given model.
public virtual Task<IViewComponentResult> BindView<TModel>(string viewName, TModel model) where TModel : class
Parameters
viewName
stringThe view to be returned.
model
TModelAn instance of
TModel
to be bound.
Returns
Type Parameters
TModel
The model to be bound.
BindView<TModel>(TModel)
Returns the default view bound to the given model.
public virtual Task<IViewComponentResult> BindView<TModel>(TModel model) where TModel : class
Parameters
model
TModelAn instance of
TModel
to be bound.
Returns
Type Parameters
TModel
The model to be bound.