DbContext.ValidateEntity, méthode
[Cette page concerne Entity Framework version 6. La dernière version est disponible sous le nom de package 'Entity Framework' NuGet. Pour plus d'informations sur Entity Framework, consultez msdn.com/data/ef.]
Point d'extension qui permet à l'utilisateur de personnaliser la validation d'une entité ou de filtrer les résultats de la validation. Appelée par GetValidationErrors().
Espace de noms : System.Data.Entity
Assembly : EntityFramework (dans EntityFramework.dll)
Syntaxe
'Déclaration
Protected Overridable Function ValidateEntity ( _
entityEntry As DbEntityEntry, _
items As IDictionary(Of Object, Object) _
) As DbEntityValidationResult
'Utilisation
Dim entityEntry As DbEntityEntry
Dim items As IDictionary(Of Object, Object)
Dim returnValue As DbEntityValidationResult
returnValue = Me.ValidateEntity(entityEntry, _
items)
protected virtual DbEntityValidationResult ValidateEntity(
DbEntityEntry entityEntry,
IDictionary<Object, Object> items
)
protected:
virtual DbEntityValidationResult^ ValidateEntity(
DbEntityEntry^ entityEntry,
IDictionary<Object^, Object^>^ items
)
abstract ValidateEntity :
entityEntry:DbEntityEntry *
items:IDictionary<Object, Object> -> DbEntityValidationResult
override ValidateEntity :
entityEntry:DbEntityEntry *
items:IDictionary<Object, Object> -> DbEntityValidationResult
protected function ValidateEntity(
entityEntry : DbEntityEntry,
items : IDictionary<Object, Object>
) : DbEntityValidationResult
Paramètres
- entityEntry
Type : System.Data.Entity.Infrastructure.DbEntityEntry
Instance DbEntityEntry à valider.
- items
Type : System.Collections.Generic.IDictionary<Object, Object>
Dictionnaire défini par l'utilisateur qui contient des informations supplémentaires sur la validation personnalisée. Il sera passé à ValidationContext et sera exposé en tant que Items. Ce paramètre est facultatif et peut avoir la valeur null.
Valeur de retour
Type : System.Data.Entity.Validation.DbEntityValidationResult
Résultat de la validation d'entité.Peut être null en cas de substitution.