vs entityframwork Validation failed for one or more entities

问题:添加数据库一条数据时出错

查找异常

catch (DbEntityValidationException dbEx)

{ foreach (var validationErrors in dbEx.EntityValidationErrors)

{ foreach (var validationError in validationErrors.ValidationErrors)

{ Trace.TraceInformation("Property: {0} Error: {1}", validationError.PropertyName, validationError.ErrorMessage); } } }

posted @ 2015-01-27 13:00  王加陈  阅读(181)  评论(0编辑  收藏  举报