Table of Contents

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 IViewModelBinder

The IViewModelBinder to enable binding.

Properties

Binder

Gets the instance of IViewModelBinder used for binding.

protected IViewModelBinder Binder { get; }

Property Value

IViewModelBinder

Methods

BindView(Type, string)

Returns the specified view bound to the given model type.

public virtual Task<IViewComponentResult> BindView(Type modelType, string viewName)

Parameters

modelType Type

The model type to be used for binding.

viewName string

The view to be returned.

Returns

Task<IViewComponentResult>

The IViewComponentResult.

BindView<TModel>()

Returns the default view using a bound model of TModel.

public virtual Task<IViewComponentResult> BindView<TModel>() where TModel : class, new()

Returns

Task<IViewComponentResult>

The IViewComponentResult.

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 string

The view to be returned.

Returns

Task<IViewComponentResult>

The IViewComponentResult.

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 string

The view to be returned.

model TModel

An instance of TModel to be bound.

Returns

Task<IViewComponentResult>

The IViewComponentResult.

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 TModel

An instance of TModel to be bound.

Returns

Task<IViewComponentResult>

The IViewComponentResult.

Type Parameters

TModel

The model to be bound.