Interface IViewModelBinder
Version: 21.x
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
Methods
Bind(Object, ViewContext)
Binds properties on the given model based on the given viewContext.
Declaration
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 model with its properties updated. |
Bind(Type, ViewContext)
Binds properties on the given modelType based on the given viewContext.
Declaration
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 modelType with its properties updated. |
Bind(TModel, ViewContext)
Binds properties on the given model based on the given viewContext.
Declaration
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 model with its properties updated. |
Type Parameters
| Name | Description |
|---|---|
| TModel | The instance type to be returned. |
Bind(ViewContext)
Creates an instance of TModel and binds properties based on the given viewContext.
Declaration
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 | A bound instance of TModel or default(TModel). |
Type Parameters
| Name | Description |
|---|---|
| TModel | The instance type to be returned. |
If you have suggestions for improving this article, let us know!