private static void SaveDBChanges(ref EXANTE_Entities db) { try { db.SaveChangesAsync(); } catch (DbEntityValidationException er) { foreach (DbEntityValidationResult eve in er.EntityValidationErrors) { Console.WriteLine( "Entity of type \"{0}\" in state \"{1}\" has the following validation errors:", eve.Entry.Entity.GetType().Name, eve.Entry.State); foreach (DbValidationError ve in eve.ValidationErrors) { Console.WriteLine("- Property: \"{0}\", Error: \"{1}\"", ve.PropertyName, ve.ErrorMessage); } } throw; } }