trace SaveChanges Exception exact error type in from DbValidationException
Getting exact error type in from DbValidationException
try { db.SaveChanges(); // DB Save changes call } catch (System.Data.Entity.Validation.DbEntityValidationException e) { foreach (var eve in e.EntityValidationErrors) { Console.WriteLine("Entity of type \"{0}\" in state \"{1}\" has the following validation errors:", eve.Entry.Entity.GetType().Name, eve.Entry.State); foreach (var ve in eve.ValidationErrors) { Console.WriteLine("- Property: \"{0}\", Error: \"{1}\"", ve.PropertyName, ve.ErrorMessage); } } throw; }
trace SaveChanges Exception exact error type in from DbValidationException
Reviewed by Bhaumik Patel
on
10:43 PM
Rating: