Example #1
0
        private void HandleSqlException(SqlException ex, IDbToBusinessEntityNameMapper mapper)
        {
            if (ex.Number == ErrorCodes.SqlUserRaisedError)
            {
                switch (ex.State)
                {
                case ErrorCodes.ValidationError:
                    string[] messageParts = ex.Errors[0].Message.Split(':');
                    throw new RepositoryValidationException(
                              mapper.MapDbParameterToBusinessEntityProperty(messageParts[0]),
                              messageParts[1], ex);

                case ErrorCodes.ConcurrencyViolationError:
                    throw new ConcurrencyViolationException(ex.Message, ex);
                }
            }

            throw new RepositoryFailureException(ex);
        }
Example #2
0
 private void HandleSqlException(DbException ex, IDbToBusinessEntityNameMapper mapper)
 {
     throw new RepositoryFailureException(ex);
 }