Validation failed for one or more entities. See 'EntityValidationErrors' property for more d
Posted Chuck Lu
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Validation failed for one or more entities. See 'EntityValidationErrors' property for more d相关的知识,希望对你有一定的参考价值。
捕获异常之后,判断是否为DbEntityValidationException
var e = exception as DbEntityValidationException; if (e != null) { 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}\", Value: \"{1}\", Error: \"{2}\"", ve.PropertyName, eve.Entry.CurrentValues.GetValue<object>(ve.PropertyName), ve.ErrorMessage); } } }
以上是关于Validation failed for one or more entities. See 'EntityValidationErrors' property for more d的主要内容,如果未能解决你的问题,请参考以下文章
Validation failed for one or more entities. See 'EntityValidationErrors' property for more d
Validation failed for one or more entities. See ‘EntityValidationErrors
“Validation failed for one or more entities”异常的解决办法
Validation failed for argument [0]
报错Validation failed for object='userLogin'. Error count: 1
spring boot 表单的实体提交错误:Validation failed for object='book'. Error count: 2