Class ContentModelBinder
Maps view models, supporting mapping to and from any IPublishedContent or IContentModel.
Inheritance
Namespace: Umbraco.Cms.Web.Common.ModelBinders
Assembly: Umbraco.Web.Common.dll
Syntax
public class ContentModelBinder
Constructors
View SourceContentModelBinder(IEventAggregator)
Initializes a new instance of the ContentModelBinder class.
Declaration
public ContentModelBinder(IEventAggregator eventAggregator)
Parameters
| Type | Name | Description |
|---|---|---|
| IEventAggregator | eventAggregator |
Methods
View SourceBindModel(ModelBindingContext, object?, Type)
Attempts to bind the model
Declaration
public void BindModel(ModelBindingContext bindingContext, object? source, Type modelType)
Parameters
| Type | Name | Description |
|---|---|---|
| ModelBindingContext | bindingContext | |
| object | source | |
| Type | modelType |
BindModelAsync(ModelBindingContext)
Attempts to bind a model.
Declaration
public Task BindModelAsync(ModelBindingContext bindingContext)
Parameters
| Type | Name | Description |
|---|---|---|
| ModelBindingContext | bindingContext | The Microsoft.AspNetCore.Mvc.ModelBinding.ModelBindingContext. |
Returns
| Type | Description |
|---|---|
| Task | A System.Threading.Tasks.Task which will complete when the model binding process completes.
If model binding was successful, the Microsoft.AspNetCore.Mvc.ModelBinding.ModelBindingContext.Result should have
Microsoft.AspNetCore.Mvc.ModelBinding.ModelBindingResult.IsModelSet set to A model binder that completes successfully should set Microsoft.AspNetCore.Mvc.ModelBinding.ModelBindingContext.Result to a value returned from Microsoft.AspNetCore.Mvc.ModelBinding.ModelBindingResult.Success(object). |