Entities.cs 650 B

123456789101112131415161718192021222324
  1. using System.Data.Entity.Validation;
  2. namespace CD67.FicheCollege.Entity
  3. {
  4. public partial class Entities
  5. {
  6. /// <summary>
  7. /// Ajout d'une meilleure gestion des exceptions Entity pour la méthode "SaveChanges"
  8. /// </summary>
  9. /// <returns></returns>
  10. public override int SaveChanges()
  11. {
  12. try
  13. {
  14. return base.SaveChanges();
  15. }
  16. catch (DbEntityValidationException e)
  17. {
  18. var newException = new Internal.FormattedDbEntityValidationException(e);
  19. throw newException;
  20. }
  21. }
  22. }
  23. }