以下を使用して例外タイプをキャッチし、詳細を追加しています。
        try
        {
            this.ApplyRules();
            return base.SaveChanges();
        }
        catch (DbEntityValidationException ex)
        {
            var sb = new StringBuilder();
            foreach (var failure in ex.EntityValidationErrors)
            {
                sb.AppendFormat("{0} failed validation\n", failure.Entry.Entity.GetType());
                foreach (var error in failure.ValidationErrors)
                {
                    sb.AppendFormat("- {0} : {1}", error.PropertyName, error.ErrorMessage);
                    sb.AppendLine();
                }
            }
            throw new DbEntityValidationException(
                "Entity Validation Failed - errors follow:\n" +
                sb.ToString(), ex
                ); // Add the original exception as the innerException
        }
        catch (Exception ex)
        {
            < some code here that would give me more detail about what the exception was >
            throw new Exception( );
        }
これは機能しますが、他のタイプの例外の innerException.exceptionMessage をキャッチできるようにしたいと考えています。
他のすべての例外タイプの最低レベルの innerException.exceptionMessage を含むコードをこれに追加する方法はありますか? 例外ツリーをたどって最終メッセージを取得するコードはありますか?