PageBase.TryUpdateModelAsync Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
TryUpdateModelAsync(Object, Type, String, IValueProvider, Func<ModelMetadata,Boolean>) |
Updates the specified |
TryUpdateModelAsync(Object, Type, String) |
Updates the specified |
TryUpdateModelAsync<TModel>(TModel) |
Updates the specified |
TryUpdateModelAsync<TModel>(TModel, String) |
Updates the specified |
TryUpdateModelAsync<TModel>(TModel, String, IValueProvider) |
Updates the specified |
TryUpdateModelAsync<TModel>(TModel, String, Func<ModelMetadata,Boolean>) |
Updates the specified |
TryUpdateModelAsync<TModel>(TModel, String, Expression<Func<TModel,Object>>[]) |
Updates the specified |
TryUpdateModelAsync<TModel>(TModel, String, IValueProvider, Func<ModelMetadata,Boolean>) |
Updates the specified |
TryUpdateModelAsync<TModel>(TModel, String, IValueProvider, Expression<Func<TModel,Object>>[]) |
Updates the specified |
TryUpdateModelAsync(Object, Type, String, IValueProvider, Func<ModelMetadata,Boolean>)
- Source:
- PageBase.cs
- Source:
- PageBase.cs
- Source:
- PageBase.cs
Updates the specified model
instance using the valueProvider
and a
prefix
.
public:
System::Threading::Tasks::Task<bool> ^ TryUpdateModelAsync(System::Object ^ model, Type ^ modelType, System::String ^ prefix, Microsoft::AspNetCore::Mvc::ModelBinding::IValueProvider ^ valueProvider, Func<Microsoft::AspNetCore::Mvc::ModelBinding::ModelMetadata ^, bool> ^ propertyFilter);
public System.Threading.Tasks.Task<bool> TryUpdateModelAsync (object model, Type modelType, string prefix, Microsoft.AspNetCore.Mvc.ModelBinding.IValueProvider valueProvider, Func<Microsoft.AspNetCore.Mvc.ModelBinding.ModelMetadata,bool> propertyFilter);
member this.TryUpdateModelAsync : obj * Type * string * Microsoft.AspNetCore.Mvc.ModelBinding.IValueProvider * Func<Microsoft.AspNetCore.Mvc.ModelBinding.ModelMetadata, bool> -> System.Threading.Tasks.Task<bool>
Public Function TryUpdateModelAsync (model As Object, modelType As Type, prefix As String, valueProvider As IValueProvider, propertyFilter As Func(Of ModelMetadata, Boolean)) As Task(Of Boolean)
Parameters
- model
- Object
The model instance to update.
- modelType
- Type
The type of model instance to update.
- prefix
- String
The prefix to use when looking up values in the valueProvider
.
- valueProvider
- IValueProvider
The IValueProvider used for looking up values.
- propertyFilter
- Func<ModelMetadata,Boolean>
A predicate which can be used to filter properties at runtime.
Returns
A Task that on completion returns true
if the update is successful.
Applies to
TryUpdateModelAsync(Object, Type, String)
- Source:
- PageBase.cs
- Source:
- PageBase.cs
- Source:
- PageBase.cs
Updates the specified model
instance using values from the Page's current
IValueProvider and a prefix
.
public:
virtual System::Threading::Tasks::Task<bool> ^ TryUpdateModelAsync(System::Object ^ model, Type ^ modelType, System::String ^ prefix);
public virtual System.Threading.Tasks.Task<bool> TryUpdateModelAsync (object model, Type modelType, string prefix);
abstract member TryUpdateModelAsync : obj * Type * string -> System.Threading.Tasks.Task<bool>
override this.TryUpdateModelAsync : obj * Type * string -> System.Threading.Tasks.Task<bool>
Public Overridable Function TryUpdateModelAsync (model As Object, modelType As Type, prefix As String) As Task(Of Boolean)
Parameters
- model
- Object
The model instance to update.
- modelType
- Type
The type of model instance to update.
- prefix
- String
The prefix to use when looking up values in the current IValueProvider.
Returns
A Task that on completion returns true
if the update is successful.
Applies to
TryUpdateModelAsync<TModel>(TModel)
- Source:
- PageBase.cs
- Source:
- PageBase.cs
- Source:
- PageBase.cs
Updates the specified model
instance using values from the Page's current
IValueProvider.
public:
generic <typename TModel>
where TModel : class virtual System::Threading::Tasks::Task<bool> ^ TryUpdateModelAsync(TModel model);
public virtual System.Threading.Tasks.Task<bool> TryUpdateModelAsync<TModel> (TModel model) where TModel : class;
abstract member TryUpdateModelAsync : 'Model -> System.Threading.Tasks.Task<bool> (requires 'Model : null)
override this.TryUpdateModelAsync : 'Model -> System.Threading.Tasks.Task<bool> (requires 'Model : null)
Public Overridable Function TryUpdateModelAsync(Of TModel As Class) (model As TModel) As Task(Of Boolean)
Type Parameters
- TModel
The type of the model object.
Parameters
- model
- TModel
The model instance to update.
Returns
A Task that on completion returns true
if the update is successful.
Applies to
TryUpdateModelAsync<TModel>(TModel, String)
- Source:
- PageBase.cs
- Source:
- PageBase.cs
- Source:
- PageBase.cs
Updates the specified model
instance using values from the Page's current
IValueProvider and a prefix
.
public:
generic <typename TModel>
where TModel : class virtual System::Threading::Tasks::Task<bool> ^ TryUpdateModelAsync(TModel model, System::String ^ prefix);
public virtual System.Threading.Tasks.Task<bool> TryUpdateModelAsync<TModel> (TModel model, string prefix) where TModel : class;
abstract member TryUpdateModelAsync : 'Model * string -> System.Threading.Tasks.Task<bool> (requires 'Model : null)
override this.TryUpdateModelAsync : 'Model * string -> System.Threading.Tasks.Task<bool> (requires 'Model : null)
Public Overridable Function TryUpdateModelAsync(Of TModel As Class) (model As TModel, prefix As String) As Task(Of Boolean)
Type Parameters
- TModel
The type of the model object.
Parameters
- model
- TModel
The model instance to update.
- prefix
- String
The prefix to use when looking up values in the current IValueProvider.
Returns
A Task that on completion returns true
if the update is successful.
Applies to
TryUpdateModelAsync<TModel>(TModel, String, IValueProvider)
- Source:
- PageBase.cs
- Source:
- PageBase.cs
- Source:
- PageBase.cs
Updates the specified model
instance using the valueProvider
and a
prefix
.
public:
generic <typename TModel>
where TModel : class virtual System::Threading::Tasks::Task<bool> ^ TryUpdateModelAsync(TModel model, System::String ^ prefix, Microsoft::AspNetCore::Mvc::ModelBinding::IValueProvider ^ valueProvider);
public virtual System.Threading.Tasks.Task<bool> TryUpdateModelAsync<TModel> (TModel model, string prefix, Microsoft.AspNetCore.Mvc.ModelBinding.IValueProvider valueProvider) where TModel : class;
abstract member TryUpdateModelAsync : 'Model * string * Microsoft.AspNetCore.Mvc.ModelBinding.IValueProvider -> System.Threading.Tasks.Task<bool> (requires 'Model : null)
override this.TryUpdateModelAsync : 'Model * string * Microsoft.AspNetCore.Mvc.ModelBinding.IValueProvider -> System.Threading.Tasks.Task<bool> (requires 'Model : null)
Public Overridable Function TryUpdateModelAsync(Of TModel As Class) (model As TModel, prefix As String, valueProvider As IValueProvider) As Task(Of Boolean)
Type Parameters
- TModel
The type of the model object.
Parameters
- model
- TModel
The model instance to update.
- prefix
- String
The prefix to use when looking up values in the valueProvider
.
- valueProvider
- IValueProvider
The IValueProvider used for looking up values.
Returns
A Task that on completion returns true
if the update is successful.
Applies to
TryUpdateModelAsync<TModel>(TModel, String, Func<ModelMetadata,Boolean>)
- Source:
- PageBase.cs
- Source:
- PageBase.cs
- Source:
- PageBase.cs
Updates the specified model
instance using values from the Page's current
IValueProvider and a prefix
.
public:
generic <typename TModel>
where TModel : class System::Threading::Tasks::Task<bool> ^ TryUpdateModelAsync(TModel model, System::String ^ prefix, Func<Microsoft::AspNetCore::Mvc::ModelBinding::ModelMetadata ^, bool> ^ propertyFilter);
public System.Threading.Tasks.Task<bool> TryUpdateModelAsync<TModel> (TModel model, string prefix, Func<Microsoft.AspNetCore.Mvc.ModelBinding.ModelMetadata,bool> propertyFilter) where TModel : class;
member this.TryUpdateModelAsync : 'Model * string * Func<Microsoft.AspNetCore.Mvc.ModelBinding.ModelMetadata, bool> -> System.Threading.Tasks.Task<bool> (requires 'Model : null)
Public Function TryUpdateModelAsync(Of TModel As Class) (model As TModel, prefix As String, propertyFilter As Func(Of ModelMetadata, Boolean)) As Task(Of Boolean)
Type Parameters
- TModel
The type of the model object.
Parameters
- model
- TModel
The model instance to update.
- prefix
- String
The prefix to use when looking up values in the current IValueProvider.
- propertyFilter
- Func<ModelMetadata,Boolean>
A predicate which can be used to filter properties at runtime.
Returns
A Task that on completion returns true
if the update is successful.
Applies to
TryUpdateModelAsync<TModel>(TModel, String, Expression<Func<TModel,Object>>[])
- Source:
- PageBase.cs
- Source:
- PageBase.cs
- Source:
- PageBase.cs
Updates the specified model
instance using values from the Page's current
IValueProvider and a prefix
.
public:
generic <typename TModel>
where TModel : class System::Threading::Tasks::Task<bool> ^ TryUpdateModelAsync(TModel model, System::String ^ prefix, ... cli::array <System::Linq::Expressions::Expression<Func<TModel, System::Object ^> ^> ^> ^ includeExpressions);
public System.Threading.Tasks.Task<bool> TryUpdateModelAsync<TModel> (TModel model, string prefix, params System.Linq.Expressions.Expression<Func<TModel,object>>[] includeExpressions) where TModel : class;
public System.Threading.Tasks.Task<bool> TryUpdateModelAsync<TModel> (TModel model, string prefix, params System.Linq.Expressions.Expression<Func<TModel,object?>>[] includeExpressions) where TModel : class;
member this.TryUpdateModelAsync : 'Model * string * System.Linq.Expressions.Expression<Func<'Model, obj>>[] -> System.Threading.Tasks.Task<bool> (requires 'Model : null)
Public Function TryUpdateModelAsync(Of TModel As Class) (model As TModel, prefix As String, ParamArray includeExpressions As Expression(Of Func(Of TModel, Object))()) As Task(Of Boolean)
Type Parameters
- TModel
The type of the model object.
Parameters
- model
- TModel
The model instance to update.
- prefix
- String
The prefix to use when looking up values in the current IValueProvider.
- includeExpressions
- Expression<Func<TModel,Object>>[]
Expression(s) which represent top-level properties which need to be included for the current model.
Returns
A Task that on completion returns true
if the update is successful.
Applies to
TryUpdateModelAsync<TModel>(TModel, String, IValueProvider, Func<ModelMetadata,Boolean>)
- Source:
- PageBase.cs
- Source:
- PageBase.cs
- Source:
- PageBase.cs
Updates the specified model
instance using the valueProvider
and a
prefix
.
public:
generic <typename TModel>
where TModel : class System::Threading::Tasks::Task<bool> ^ TryUpdateModelAsync(TModel model, System::String ^ prefix, Microsoft::AspNetCore::Mvc::ModelBinding::IValueProvider ^ valueProvider, Func<Microsoft::AspNetCore::Mvc::ModelBinding::ModelMetadata ^, bool> ^ propertyFilter);
public System.Threading.Tasks.Task<bool> TryUpdateModelAsync<TModel> (TModel model, string prefix, Microsoft.AspNetCore.Mvc.ModelBinding.IValueProvider valueProvider, Func<Microsoft.AspNetCore.Mvc.ModelBinding.ModelMetadata,bool> propertyFilter) where TModel : class;
member this.TryUpdateModelAsync : 'Model * string * Microsoft.AspNetCore.Mvc.ModelBinding.IValueProvider * Func<Microsoft.AspNetCore.Mvc.ModelBinding.ModelMetadata, bool> -> System.Threading.Tasks.Task<bool> (requires 'Model : null)
Public Function TryUpdateModelAsync(Of TModel As Class) (model As TModel, prefix As String, valueProvider As IValueProvider, propertyFilter As Func(Of ModelMetadata, Boolean)) As Task(Of Boolean)
Type Parameters
- TModel
The type of the model object.
Parameters
- model
- TModel
The model instance to update.
- prefix
- String
The prefix to use when looking up values in the valueProvider
.
- valueProvider
- IValueProvider
The IValueProvider used for looking up values.
- propertyFilter
- Func<ModelMetadata,Boolean>
A predicate which can be used to filter properties at runtime.
Returns
A Task that on completion returns true
if the update is successful.
Applies to
TryUpdateModelAsync<TModel>(TModel, String, IValueProvider, Expression<Func<TModel,Object>>[])
- Source:
- PageBase.cs
- Source:
- PageBase.cs
- Source:
- PageBase.cs
Updates the specified model
instance using the valueProvider
and a
prefix
.
public:
generic <typename TModel>
where TModel : class System::Threading::Tasks::Task<bool> ^ TryUpdateModelAsync(TModel model, System::String ^ prefix, Microsoft::AspNetCore::Mvc::ModelBinding::IValueProvider ^ valueProvider, ... cli::array <System::Linq::Expressions::Expression<Func<TModel, System::Object ^> ^> ^> ^ includeExpressions);
public System.Threading.Tasks.Task<bool> TryUpdateModelAsync<TModel> (TModel model, string prefix, Microsoft.AspNetCore.Mvc.ModelBinding.IValueProvider valueProvider, params System.Linq.Expressions.Expression<Func<TModel,object>>[] includeExpressions) where TModel : class;
public System.Threading.Tasks.Task<bool> TryUpdateModelAsync<TModel> (TModel model, string prefix, Microsoft.AspNetCore.Mvc.ModelBinding.IValueProvider valueProvider, params System.Linq.Expressions.Expression<Func<TModel,object?>>[] includeExpressions) where TModel : class;
member this.TryUpdateModelAsync : 'Model * string * Microsoft.AspNetCore.Mvc.ModelBinding.IValueProvider * System.Linq.Expressions.Expression<Func<'Model, obj>>[] -> System.Threading.Tasks.Task<bool> (requires 'Model : null)
Public Function TryUpdateModelAsync(Of TModel As Class) (model As TModel, prefix As String, valueProvider As IValueProvider, ParamArray includeExpressions As Expression(Of Func(Of TModel, Object))()) As Task(Of Boolean)
Type Parameters
- TModel
The type of the model object.
Parameters
- model
- TModel
The model instance to update.
- prefix
- String
The prefix to use when looking up values in the valueProvider
.
- valueProvider
- IValueProvider
The IValueProvider used for looking up values.
- includeExpressions
- Expression<Func<TModel,Object>>[]
Expression(s) which represent top-level properties which need to be included for the current model.
Returns
A Task that on completion returns true
if the update is successful.