Entities.cs 763 B

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