c# 检查报错详细

catch (DbEntityValidationException error)
            {
                string test = string.Empty;
                foreach (var validationErrors in error.EntityValidationErrors)
                {
                    foreach (var validationError in validationErrors.ValidationErrors)
                    {
                        test = string.Format("Class: {0}, Property: {1}, Error: {2}",
                            validationErrors.Entry.Entity.GetType().FullName,
                            validationError.PropertyName,
                            validationError.ErrorMessage);
                    }
                }
}

 

posted @ 2018-10-23 13:46  jasonlai2016  阅读(544)  评论(0编辑  收藏  举报