DbContext.ValidateEntity (Método)
[Esta página es específica de la versión 6 de Entity Framework. La versión más reciente está disponible como el paquete NuGet de Entity Framework. Para más información sobre Entity Framework, consulte msdn.com/es-ES/data/ef].
Punto de extensión que permite al usuario personalizar la validación de una entidad o filtrar los resultados de la validación. Lo llama el método GetValidationErrors().
Espacio de nombres: System.Data.Entity
Ensamblado: EntityFramework (en EntityFramework.dll)
Sintaxis
'Declaración
Protected Overridable Function ValidateEntity ( _
entityEntry As DbEntityEntry, _
items As IDictionary(Of Object, Object) _
) As DbEntityValidationResult
'Uso
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
Parámetros
- entityEntry
Tipo: System.Data.Entity.Infrastructure.DbEntityEntry
Instancia de DbEntityEntry que se va a validar.
- items
Tipo: System.Collections.Generic.IDictionary<Object, Object>
Diccionario definido por el usuario que contiene información adicional para la validación personalizada. Se pasará a ValidationContext y se expondrá como Items. Este parámetro es opcional y su valor puede ser null.
Valor devuelto
Tipo: System.Data.Entity.Validation.DbEntityValidationResult
El resultado de la validación de la entidad.El valor puede ser null cuando se reemplaza.