Share via


DbContext.ValidateEntity Method

Definition

Extension point allowing the user to customize validation of an entity or filter out validation results. Called by GetValidationErrors().

protected virtual System.Data.Entity.Validation.DbEntityValidationResult ValidateEntity (System.Data.Entity.Infrastructure.DbEntityEntry entityEntry, System.Collections.Generic.IDictionary<object,object> items);
abstract member ValidateEntity : System.Data.Entity.Infrastructure.DbEntityEntry * System.Collections.Generic.IDictionary<obj, obj> -> System.Data.Entity.Validation.DbEntityValidationResult
override this.ValidateEntity : System.Data.Entity.Infrastructure.DbEntityEntry * System.Collections.Generic.IDictionary<obj, obj> -> System.Data.Entity.Validation.DbEntityValidationResult
Protected Overridable Function ValidateEntity (entityEntry As DbEntityEntry, items As IDictionary(Of Object, Object)) As DbEntityValidationResult

Parameters

entityEntry
DbEntityEntry

DbEntityEntry instance to be validated.

items
IDictionary<Object,Object>

User-defined dictionary containing additional info for custom validation. It will be passed to ValidationContext and will be exposed as Items . This parameter is optional and can be null.

Returns

Entity validation result. Possibly null when overridden.

Applies to