/// <summary>
 /// Private constructor used by all public constructors.
 /// </summary>
 /// <param name="changeSet">the changeset being submitted</param>
 /// <param name="message">The localized error message</param>
 /// <param name="innerException">Optional inner exception.</param>
 /// <param name="status">status of the exception</param>
 /// <param name="errorCode">custom error code</param>
 /// <param name="stackTrace">stack trace of the exception</param>
 private SubmitOperationException(EntityChangeSet changeSet, string message, Exception innerException, OperationErrorStatus status, int errorCode, string stackTrace)
     : base(message, innerException, status, errorCode, stackTrace, GetValidationResults(changeSet))
 {
     _changeSet       = changeSet;
     _entitiesInError = new ReadOnlyCollection <Entity>(changeSet
                                                        .Where(p => p.EntityConflict != null || p.HasValidationErrors)
                                                        .ToList());
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Create a IEnumerable which iterates the changeset and returns all validation errors
 /// </summary>
 /// <param name="changeSet">ChangeSet to read validation errors from</param>
 /// <returns></returns>
 private static IEnumerable <ValidationResult> GetValidationResults(EntityChangeSet changeSet)
 {
     return(changeSet.Where(p => p.EntityConflict != null || p.HasValidationErrors)
            .SelectMany(p => p.ValidationErrors));
 }