Controller.UpdateModel(Of TModel) Method

[Note: This topic is pre-release documentation and is subject to change in future releases. Blank topics are included as placeholders.]

Updates the specified model instance using values from the controller's current value provider.

  NameDescription
Protected method UpdateModel(Of TModel)(TModel) Updates the specified model instance using values from the controller's current value provider.
Protected method UpdateModel(Of TModel)(TModel, String) Updates the specified model instance using values from the controller's current value provider and a prefix.
Protected method UpdateModel(Of TModel)(TModel, String()) Updates the specified model instance using values from the controller object's current value provider.
Protected method UpdateModel(Of TModel)(TModel, IValueProvider) Updates the specified model instance using values from the value provider.
Protected method UpdateModel(Of TModel)(TModel, String, String()) Updates the specified model instance using values from the controller's current value provider, a prefix, and included properties.
Protected method UpdateModel(Of TModel)(TModel, String, IValueProvider) Updates the specified model instance using values from the value provider and a prefix.
Protected method UpdateModel(Of TModel)(TModel, String(), IValueProvider) Updates the specified model instance using values from the value provider, a prefix, and included properties.
Protected method UpdateModel(Of TModel)(TModel, String, String(), String()) Updates the specified model instance using values from the controller's current value provider, a prefix, excluded properties, and included properties.
Protected method UpdateModel(Of TModel)(TModel, String, String(), IValueProvider) Updates the specified model instance using values from the value provider, a prefix, and included properties.
Protected method UpdateModel(Of TModel)(TModel, String, String(), String(), IValueProvider) Updates the specified model instance using values from the value provider, a prefix, excluded properties, and included properties.
Top

You do not have to explicitly specify the generic parameter TModel. Instead, you can let the C# or Visual Basic type inference engine determine the generic parameter TModel by omitting it.

The TryUpdateModel(Of TModel) method is like the UpdateModel(Of TModel) method except that the TryUpdateModel(Of TModel) method does not throw an InvalidOperationException exception if the updated model state is not valid.

Security note Security Note

Use one of the TryUpdateModel(Of TModel) methods that takes either a list of included properties (a whitelist) or a list of excluded properties (a blacklist). If no explicit whitelist or blacklist is passed, the TryUpdateModel(Of TModel) method tries to update every public property of your model for which there is a corresponding value in the request. A malicious user could exploit this in order to update properties that you do not intend to provide access to.

Show: