DbContext.GetValidationErrors Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Validates tracked entities and returns a Collection of DbEntityValidationResult containing validation results.
public System.Collections.Generic.IEnumerable<System.Data.Entity.Validation.DbEntityValidationResult> GetValidationErrors ();
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate")]
public System.Collections.Generic.IEnumerable<System.Data.Entity.Validation.DbEntityValidationResult> GetValidationErrors ();
member this.GetValidationErrors : unit -> seq<System.Data.Entity.Validation.DbEntityValidationResult>
Public Function GetValidationErrors () As IEnumerable(Of DbEntityValidationResult)
Returns
Collection of validation results for invalid entities. The collection is never null and must not contain null values or results for valid entities.
- Attributes
Remarks
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.
Applies to
Entity Framework