Interface IViewModelBinder
Contract that allows models to be bound based on a Microsoft.AspNetCore.Mvc.Rendering.ViewContext.
Namespace: Sitecore.AspNet.RenderingEngine.Binding
Assembly: Sitecore.AspNet.RenderingEngine.Abstractions.dll
Syntax
public interface IViewModelBinder
Methods
Bind(Object, ViewContext)
Binds properties on the given model
based on the given
viewContext
.
Declaration
Task Bind(object model, ViewContext viewContext)
Parameters
Type | Name | Description |
---|---|---|
System.Object | model | The instance type to be returned. |
Microsoft.AspNetCore.Mvc.Rendering.ViewContext | viewContext | The Microsoft.AspNetCore.Mvc.Rendering.ViewContext to bind against. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | The instance of |
Bind(Type, ViewContext)
Binds properties on the given modelType
based on the given
viewContext
.
Declaration
Task<object> Bind(Type modelType, ViewContext viewContext)
Parameters
Type | Name | Description |
---|---|---|
System.Type | modelType | The instance type to be returned. |
Microsoft.AspNetCore.Mvc.Rendering.ViewContext | viewContext | The Microsoft.AspNetCore.Mvc.Rendering.ViewContext to bind against. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.Object> | The instance of |
Bind<TModel>(TModel, ViewContext)
Binds properties on the given model
based on the given
viewContext
.
Declaration
Task Bind<TModel>(TModel model, ViewContext viewContext)
where TModel : class
Parameters
Type | Name | Description |
---|---|---|
TModel | model | Ths instance to be bound. |
Microsoft.AspNetCore.Mvc.Rendering.ViewContext | viewContext | The Microsoft.AspNetCore.Mvc.Rendering.ViewContext to bind against. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | The instance of |
Type Parameters
Name | Description |
---|---|
TModel | The instance type to be returned. |
Bind<TModel>(ViewContext)
Creates an instance of TModel
and binds properties
based on the given viewContext
.
Declaration
Task<TModel> Bind<TModel>(ViewContext viewContext)
where TModel : class, new()
Parameters
Type | Name | Description |
---|---|---|
Microsoft.AspNetCore.Mvc.Rendering.ViewContext | viewContext | The Microsoft.AspNetCore.Mvc.Rendering.ViewContext to bind against. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<TModel> | A bound instance of |
Type Parameters
Name | Description |
---|---|
TModel | The instance type to be returned. |