Export (0) Print
Expand All

DbContext.GetValidationErrors Method

Entity Framework 5.0

Validates tracked entities and returns a Collection of DbEntityValidationResult containing validation results.

Namespace:  System.Data.Entity
Assembly:  EntityFramework (in EntityFramework.dll)

member GetValidationErrors : unit -> IEnumerable<DbEntityValidationResult> 

Return Value

Type: System.Collections.Generic.IEnumerable(DbEntityValidationResult)
Collection of validation results for invalid entities. The collection is never a null reference (Nothing in Visual Basic) and must not contain a null reference (Nothing in Visual Basic) values or results for valid entities.

This method calls DetectChanges() to determine states of the tracked entities unless AutoDetectChangesEnabledis set to false. By default only Added and Modified entities are validated. You can change this behavior by overriding the ShouldValidateEntity(DbEntityEntry) method.

© 2015 Microsoft