ModelStateDictionaryExtensions.AddModelError Methode

Definition

Überlädt

AddModelError<TModel>(ModelStateDictionary, Expression<Func<TModel,Object>>, String)

Fügt der angegebenen errorMessage instance Errors hinzu, die dem angegebenen expressionzugeordnet ist. Wenn die maximale Anzahl zulässiger Fehler bereits aufgezeichnet wurde, wird stattdessen sichergestellt, dass eine TooManyModelErrorsException Ausnahme aufgezeichnet wird.

AddModelError<TModel>(ModelStateDictionary, Expression<Func<TModel,Object>>, Exception, ModelMetadata)

Fügt der angegebenen exception instance Errors hinzu, die dem angegebenen expressionzugeordnet ist. Wenn die maximale Anzahl zulässiger Fehler bereits aufgezeichnet wurde, wird stattdessen sichergestellt, dass eine TooManyModelErrorsException Ausnahme aufgezeichnet wird.

AddModelError<TModel>(ModelStateDictionary, Expression<Func<TModel,Object>>, String)

Fügt der angegebenen errorMessage instance Errors hinzu, die dem angegebenen expressionzugeordnet ist. Wenn die maximale Anzahl zulässiger Fehler bereits aufgezeichnet wurde, wird stattdessen sichergestellt, dass eine TooManyModelErrorsException Ausnahme aufgezeichnet wird.

public:
generic <typename TModel>
[System::Runtime::CompilerServices::Extension]
 static void AddModelError(Microsoft::AspNetCore::Mvc::ModelBinding::ModelStateDictionary ^ modelState, System::Linq::Expressions::Expression<Func<TModel, System::Object ^> ^> ^ expression, System::String ^ errorMessage);
public static void AddModelError<TModel> (this Microsoft.AspNetCore.Mvc.ModelBinding.ModelStateDictionary modelState, System.Linq.Expressions.Expression<Func<TModel,object>> expression, string errorMessage);
static member AddModelError : Microsoft.AspNetCore.Mvc.ModelBinding.ModelStateDictionary * System.Linq.Expressions.Expression<Func<'Model, obj>> * string -> unit
<Extension()>
Public Sub AddModelError(Of TModel) (modelState As ModelStateDictionary, expression As Expression(Of Func(Of TModel, Object)), errorMessage As String)

Typparameter

TModel

Der Typ des Modells.

Parameter

modelState
ModelStateDictionary

Die ModelStateDictionary instance diese Methode erweitert.

expression
Expression<Func<TModel,Object>>

Ein Ausdruck, der für ein Element im aktuellen Modell ausgewertet werden soll.

errorMessage
String

Die hinzuzufügende Fehlermeldung.

Gilt für:

AddModelError<TModel>(ModelStateDictionary, Expression<Func<TModel,Object>>, Exception, ModelMetadata)

Fügt der angegebenen exception instance Errors hinzu, die dem angegebenen expressionzugeordnet ist. Wenn die maximale Anzahl zulässiger Fehler bereits aufgezeichnet wurde, wird stattdessen sichergestellt, dass eine TooManyModelErrorsException Ausnahme aufgezeichnet wird.

public:
generic <typename TModel>
[System::Runtime::CompilerServices::Extension]
 static void AddModelError(Microsoft::AspNetCore::Mvc::ModelBinding::ModelStateDictionary ^ modelState, System::Linq::Expressions::Expression<Func<TModel, System::Object ^> ^> ^ expression, Exception ^ exception, Microsoft::AspNetCore::Mvc::ModelBinding::ModelMetadata ^ metadata);
public static void AddModelError<TModel> (this Microsoft.AspNetCore.Mvc.ModelBinding.ModelStateDictionary modelState, System.Linq.Expressions.Expression<Func<TModel,object>> expression, Exception exception, Microsoft.AspNetCore.Mvc.ModelBinding.ModelMetadata metadata);
static member AddModelError : Microsoft.AspNetCore.Mvc.ModelBinding.ModelStateDictionary * System.Linq.Expressions.Expression<Func<'Model, obj>> * Exception * Microsoft.AspNetCore.Mvc.ModelBinding.ModelMetadata -> unit
<Extension()>
Public Sub AddModelError(Of TModel) (modelState As ModelStateDictionary, expression As Expression(Of Func(Of TModel, Object)), exception As Exception, metadata As ModelMetadata)

Typparameter

TModel

Der Typ des Modells.

Parameter

modelState
ModelStateDictionary

Die ModelStateDictionary instance diese Methode erweitert.

expression
Expression<Func<TModel,Object>>

Ein Ausdruck, der für ein Element im aktuellen Modell ausgewertet werden soll.

exception
Exception

Das hinzuzufügende Exception.

metadata
ModelMetadata

Die ModelMetadata dem Modell zugeordnete.

Gilt für: