Example #1
0
        public int SaveChanges()
        {
            try
            {
                return(MinifutbolContext.SaveChanges());
            }
            catch (DbEntityValidationException devx)
            {
                Logger.Error("Db Entity Validation Exception Occured: ", devx);

                foreach (var error in devx.EntityValidationErrors)
                {
                    Logger.Error(string.Format("Entity of type \"{0}\" in state \"{1}\" has the following validation errors:", error.Entry.Entity.GetType().Name, error.Entry.State));

                    foreach (var ve in error.ValidationErrors)
                    {
                        Logger.Error(string.Format("Property: \"{0}\", Error: \"{1}\"", ve.PropertyName, ve.ErrorMessage));
                    }
                }

                throw;
            }
            //try
            //{
            //    return MinifutbolContext.SaveChanges();

            //}
            //catch (Exception ex)
            //{
            //    throw;
            //}
        }