Interface IViewModelBinder
- Namespace
- Sitecore.AspNetCore.SDK.RenderingEngine.Binding
- Assembly
- Sitecore.AspNetCore.SDK.RenderingEngine.dll
Contract that allows models to be bound based on a ViewContext.
public interface IViewModelBinder
Methods
Bind(object, ViewContext)
Binds properties on the given model based on the given
viewContext.
Task Bind(object model, ViewContext viewContext)
Parameters
modelobjectThe instance type to be returned.
viewContextViewContextThe ViewContext to bind against.
Returns
- Task
The instance of
modelwith its properties updated.
Bind(Type, ViewContext)
Binds properties on the given modelType based on the given
viewContext.
Task<object> Bind(Type modelType, ViewContext viewContext)
Parameters
modelTypeTypeThe instance type to be returned.
viewContextViewContextThe ViewContext to bind against.
Returns
Bind<TModel>(ViewContext)
Creates an instance of TModel and binds properties
based on the given viewContext.
Task<TModel> Bind<TModel>(ViewContext viewContext) where TModel : class, new()
Parameters
viewContextViewContextThe ViewContext to bind against.
Returns
- Task<TModel>
A bound instance of
TModelor default(TModel).
Type Parameters
TModelThe instance type to be returned.
Bind<TModel>(TModel, ViewContext)
Binds properties on the given model based on the given
viewContext.
Task Bind<TModel>(TModel model, ViewContext viewContext) where TModel : class
Parameters
modelTModelThs instance to be bound.
viewContextViewContextThe ViewContext to bind against.
Returns
- Task
The instance of
modelwith its properties updated.
Type Parameters
TModelThe instance type to be returned.