DbContext::GetValidationErrors Method ()

Entity Framework 6.0

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

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

[SuppressMessageAttribute("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate")]
IEnumerable<DbEntityValidationResult^>^ GetValidationErrors()

Return Value

Type: System.Collections.Generic::IEnumerable<DbEntityValidationResult^>^

Collection of validation results for invalid entities. The collection is never null and must not contain null values or results for valid entities.

1. This method calls DetectChanges() to determine states of the tracked entities unless DbContextConfiguration.AutoDetectChangesEnabled is set to false. 2. By default only Added on Modified entities are validated. The user is able to change this behavior by overriding ShouldValidateEntity method.

Return to top