コード例 #1
0
        private IQueryable <Course> TryCatch(ReturningQueryableCourseFunction returningQueryableCourseFunction)
        {
            try
            {
                return(returningQueryableCourseFunction());
            }
            catch (SqlException sqlException)
            {
                throw CreateAndLogCriticalDependencyException(sqlException);
            }
            catch (DuplicateKeyException duplicateKeyException)
            {
                var alreadyExistsCourseException =
                    new AlreadyExistsCourseException(duplicateKeyException);

                throw CreateAndLogValidationException(alreadyExistsCourseException);
            }
            catch (DbUpdateConcurrencyException dbUpdateConcurrencyException)
            {
                var lockedCourseException = new LockedCourseException(dbUpdateConcurrencyException);

                throw CreateAndLogDependencyException(lockedCourseException);
            }
            catch (DbUpdateException dbUpdateException)
            {
                throw CreateAndLogDependencyException(dbUpdateException);
            }
            catch (Exception exception)
            {
                throw CreateAndLogServiceException(exception);
            }
        }
コード例 #2
0
 private IQueryable <Course> TryCatch(ReturningQueryableCourseFunction returningQueryableCourseFunction)
 {
     try
     {
         return(returningQueryableCourseFunction());
     }
     catch (SqlException sqlException)
     {
         throw CreateAndLogCriticalDependencyException(sqlException);
     }
     catch (Exception exception)
     {
         throw CreateAndLogServiceException(exception);
     }
 }