Validator.ValidateObject Methode
Definitie
Belangrijk
Bepaalde informatie heeft betrekking op een voorlopige productversie die aanzienlijk kan worden gewijzigd voordat deze wordt uitgebracht. Microsoft biedt geen enkele expliciete of impliciete garanties met betrekking tot de informatie die hier wordt verstrekt.
Bepaalt of het opgegeven object geldig is.
Overloads
| Name | Description |
|---|---|
| ValidateObject(Object, ValidationContext) |
Bepaalt of het opgegeven object geldig is met behulp van de validatiecontext. |
| ValidateObject(Object, ValidationContext, Boolean) |
Bepaalt of het opgegeven object geldig is met behulp van de validatiecontext en een waarde die aangeeft of alle eigenschappen moeten worden gevalideerd. |
ValidateObject(Object, ValidationContext)
- Bron:
- Validator.cs
- Bron:
- Validator.cs
- Bron:
- Validator.cs
- Bron:
- Validator.cs
- Bron:
- Validator.cs
Bepaalt of het opgegeven object geldig is met behulp van de validatiecontext.
public:
static void ValidateObject(System::Object ^ instance, System::ComponentModel::DataAnnotations::ValidationContext ^ validationContext);
public static void ValidateObject(object instance, System.ComponentModel.DataAnnotations.ValidationContext validationContext);
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("Constructing a ValidationContext without a display name is not trim-safe because it uses reflection to discover the type of the instance being validated in order to resolve the DisplayNameAttribute when a display name is not provided.")]
public static void ValidateObject(object instance, System.ComponentModel.DataAnnotations.ValidationContext validationContext);
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("The Type of instance cannot be statically discovered.")]
public static void ValidateObject(object instance, System.ComponentModel.DataAnnotations.ValidationContext validationContext);
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("The Type of instance cannot be statically discovered and the Type's properties can be trimmed.")]
public static void ValidateObject(object instance, System.ComponentModel.DataAnnotations.ValidationContext validationContext);
static member ValidateObject : obj * System.ComponentModel.DataAnnotations.ValidationContext -> unit
[<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("Constructing a ValidationContext without a display name is not trim-safe because it uses reflection to discover the type of the instance being validated in order to resolve the DisplayNameAttribute when a display name is not provided.")>]
static member ValidateObject : obj * System.ComponentModel.DataAnnotations.ValidationContext -> unit
[<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("The Type of instance cannot be statically discovered.")>]
static member ValidateObject : obj * System.ComponentModel.DataAnnotations.ValidationContext -> unit
[<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("The Type of instance cannot be statically discovered and the Type's properties can be trimmed.")>]
static member ValidateObject : obj * System.ComponentModel.DataAnnotations.ValidationContext -> unit
Public Shared Sub ValidateObject (instance As Object, validationContext As ValidationContext)
Parameters
- instance
- Object
Het object dat moet worden gevalideerd.
- validationContext
- ValidationContext
De context die het object beschrijft dat moet worden gevalideerd.
- Kenmerken
Uitzonderingen
Het object is ongeldig.
instance is null.
instance komt niet overeen met de ObjectInstance on validationContext.
Opmerkingen
Met deze methode wordt elke ValidationAttribute instantie geëvalueerd die is gekoppeld aan het objecttype.
Van toepassing op
ValidateObject(Object, ValidationContext, Boolean)
- Bron:
- Validator.cs
- Bron:
- Validator.cs
- Bron:
- Validator.cs
- Bron:
- Validator.cs
- Bron:
- Validator.cs
Bepaalt of het opgegeven object geldig is met behulp van de validatiecontext en een waarde die aangeeft of alle eigenschappen moeten worden gevalideerd.
public:
static void ValidateObject(System::Object ^ instance, System::ComponentModel::DataAnnotations::ValidationContext ^ validationContext, bool validateAllProperties);
public static void ValidateObject(object instance, System.ComponentModel.DataAnnotations.ValidationContext validationContext, bool validateAllProperties);
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("Constructing a ValidationContext without a display name is not trim-safe because it uses reflection to discover the type of the instance being validated in order to resolve the DisplayNameAttribute when a display name is not provided.")]
public static void ValidateObject(object instance, System.ComponentModel.DataAnnotations.ValidationContext validationContext, bool validateAllProperties);
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("The Type of instance cannot be statically discovered.")]
public static void ValidateObject(object instance, System.ComponentModel.DataAnnotations.ValidationContext validationContext, bool validateAllProperties);
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("The Type of instance cannot be statically discovered and the Type's properties can be trimmed.")]
public static void ValidateObject(object instance, System.ComponentModel.DataAnnotations.ValidationContext validationContext, bool validateAllProperties);
static member ValidateObject : obj * System.ComponentModel.DataAnnotations.ValidationContext * bool -> unit
[<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("Constructing a ValidationContext without a display name is not trim-safe because it uses reflection to discover the type of the instance being validated in order to resolve the DisplayNameAttribute when a display name is not provided.")>]
static member ValidateObject : obj * System.ComponentModel.DataAnnotations.ValidationContext * bool -> unit
[<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("The Type of instance cannot be statically discovered.")>]
static member ValidateObject : obj * System.ComponentModel.DataAnnotations.ValidationContext * bool -> unit
[<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("The Type of instance cannot be statically discovered and the Type's properties can be trimmed.")>]
static member ValidateObject : obj * System.ComponentModel.DataAnnotations.ValidationContext * bool -> unit
Public Shared Sub ValidateObject (instance As Object, validationContext As ValidationContext, validateAllProperties As Boolean)
Parameters
- instance
- Object
Het object dat moet worden gevalideerd.
- validationContext
- ValidationContext
De context die het object beschrijft dat moet worden gevalideerd.
- validateAllProperties
- Boolean
true om alle eigenschappen te valideren; anders, false.
- Kenmerken
Uitzonderingen
instance is ongeldig.
instance is null.
instance komt niet overeen met de ObjectInstance on validationContext.
Opmerkingen
Met deze methode wordt elke ValidationAttribute instantie geëvalueerd die is gekoppeld aan het objecttype.