title: Handling specific Entity Framework exceptions - standards/guidelines?
body: <p><strong>When querying from the database using Entity Framework, what exceptions should one catch and what should be done about them?</strong></p>
  
  <p>Generally I use <code>catch(Exception)</code> because I have no specific action or feedback for every possible type of error, but I am constantly reminded that this is a terrible idea and that specific exceptions should be caught and handled!  Example:</p>
  
  <pre><code>try
  {
      using(MyEntities context = new MyEntities())
      {
          context.Companies.Attach(company);
          ActiveEmployees = company.Employees.Where(x =&gt; x.IsActive).ToList();
      }
  }
  catch(Exception ex)
  {
      Feedback(FeedbackType.ApplicationError); // User feedback
      Logger.Log(ex);  // Log the exception
  }
  </code></pre>
  
  <p>What are the standards/guidelines for handling EF exceptions?</p>