Пример #1
0
        /// <summary>
        /// Wraps the exception given in a new exception, and gets a verbose message
        /// from the DbEntityValidationException derived instance.
        /// </summary>
        /// <param name="e">The DbEntityValidationException instance to be used to create the more verbose exception.</param>
        /// <returns>A new exception with a verbose message, and an innerException of the passed in exception.</returns>
        public static Exception WrapDbEntityValidationException(Exception e)
        {
            DbEntityValidationExceptionAccessor validation = new DbEntityValidationExceptionAccessor(e);

            return(new InvalidOperationException(validation.CreateVerboseMessage(), e));
        }
Пример #2
0
 public static Exception WrapDbEntityValidationException(Exception e)
 {
     DbEntityValidationExceptionAccessor accessor = new DbEntityValidationExceptionAccessor(e);
     return new InvalidOperationException(accessor.CreateVerboseMessage(), e);
 }
Пример #3
0
 /// <summary>
 /// Determines if the exception is of the type DbEntityValidationException
 /// </summary>
 /// <param name="e">The exception instance to check.</param>
 /// <returns>True if the exception is derived from DbEntityValidationException, and False otherwise.</returns>
 public static bool IsDbEntityValidationException(Exception e)
 {
     return(DbEntityValidationExceptionAccessor.IsDbEntityValidationException(e));
 }