コード例 #1
0
        private bool IncludeThisOne(string exception)
        {
            if (Filter == ExceptionClassification.NotClassified)
            {
                return(true);
            }

            var classification = ExceptionClassifier.Classify(exception);

            return(classification == Filter);
        }
コード例 #2
0
 public void Commit()
 {
     try
     {
         Context.SaveChanges();
     }
     catch (Exception ex) //DbUpdateConcurrencyException ex)
     {
         var category = ExceptionClassifier.Classify(ex.InnerException.InnerException);
         if (category == ExceptionType.ForeignKey)
         {
             throw new Exception(ex.InnerException.InnerException.Message);
         }
         else
         {
             throw;
         }
         //throw;
         //if (ex is DbUpdateConcurrencyException )
         //{
         //    var dbCCExp = ex as DbUpdateConcurrencyException ;
         //    dbCCExp.Entries.Single().Reload();
         //    Context.SaveChanges();
         //}
         //if (ex.InnerException != null)
         //{
         //    var category = ExceptionClassifier.Classify(ex.InnerException.InnerException);
         //    switch (category)
         //    {
         //        case ExceptionType.ForeignKey:
         //            throw;
         //            break;
         //    }
         //}
     }
 }