Validation failed for one or more entities.
- 验证失败后用DbEntityValidationException 查找出错的字段
- try
- {
- // Your code...
- // Could also be before try if you know the exception occurs in SaveChanges
- int effect = await _unitOfWorkAsync.SaveChangesAsync();
- }
- catch (System.Data.Entity.Validation.DbEntityValidationException e)
- {
- 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}\", Error: \"{1}\"",
- ve.PropertyName, ve.ErrorMessage);
- }
- }
- throw;
- }
Validation failed for one or more entities.的更多相关文章
- Validation failed for one or more entities. See ‘EntityValidationErrors’解决方法
Validation failed for one or more entities. See ‘EntityValidationErrors’解决方法 You can extract all the ...
- Validation failed for one or more entities. See 'EntityValidationErrors' property for more details.
Validation failed for one or more entities. See 'EntityValidationErrors' property for more details. ...
- Validation failed for one or more entities. See ‘EntityValidationErrors’解决方法【转载】
摘自:http://www.cnblogs.com/douqiumiao/default.aspx?opt=msg Validation failed for one or more entities ...
- “Validation failed for one or more entities”异常的解决办法
日志中出现Entity Framework修改数据库时的错误: Validation failed for one or more entities. See 'EntityValidationErr ...
- EF中,保存实体报错:Validation failed for one or more entities. 如何知道具体错误在哪?
异常提示:Validation failed for one or more entities. See 'EntityValidationErrors' property for more deta ...
- vs报错找不到错在哪里!Validation failed for one or more entities
今天在处理Entity Framework修改数据库时,报错: Validation failed for one or more entities. See 'EntityValidationErr ...
- Entity Framework插入数据报错:Validation failed for one or more entities
www.111cn.net 编辑:lanve 来源:转载 今天在处理Entity Framework插入数据库时,报错: Validation failed for one or more entit ...
- Validation failed for one or more entities. See ‘EntityValidationErrors’解决方法;关于如何查看 EntityValidationErrors 详细信息的解决方法
我们在 EF 的编程中,有时候会遇到这样一个错误: 但是,按照他的提示 "See 'EntityValidationErrors' property for more details.&qu ...
- 报错:Validation failed for one or more entities. See 'EntityValidationErrors' property for more details.
在保存数据的时候报这个错误,知道是验证错误,但到底是哪个属性验证错误呢? →打断点,运行,观察程序出错的地方→在出错的部分添加try...catch语句块→添加监视,输入((System.Data.E ...
随机推荐
- LCD相关知识点
1.LCD即液晶显示器,控制原理是控制其中的电子枪,在n行*n列的屏幕上投射不同颜色从而形成图像 2.编程步骤: ①打开LCD背光将LCD背光对应的GPIO设置为禁止上拉(GPxUP相应位写入1),选 ...
- Ubuntu系统下Xen虚拟机的基本安装方法(代码创建)
Ubuntu上Xen安装虚拟机方法一dd一个空的磁盘sudo dd if=/dev/zero of=/home/vm1.img bs=1G count=8 下载Xen VM通用配置文件 sudo wg ...
- Oil Deposits
Oil Deposits Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Tota ...
- 【LeetCode OJ】Recover Binary Search Tree
Problem Link: https://oj.leetcode.com/problems/recover-binary-search-tree/ We know that the inorder ...
- Cruehead.1
查壳 没有 我拖 alt+F9 到上面 入口处 下断 关键跳 略过 就没了 要实现 强暴 直接过... 仔细来看看... 那两个调用 都下断 看看 判断 ...
- react native 之上传文件
最近遇到react native中需要上传一些图片到后台.期间,找了一些第三方上传插件,感觉不太好用,要么只支持一个平台,要么会对其他第三方造成影响,实在无奈.只能直接使用fetch上传.其中上传文件 ...
- Html 之div+css布局之css选择器
CSS选择器 什么叫选择器?通俗的来说就是 我想改变html 中某个地方的 字体大小 或者背景色 或者其它属性 内边距 外边距,宽度高度 等等 一些Css 样式. 那么我们如何找到对应的 元素呢? ...
- js 关键字和保留字
不能把关键字.保留字.true.false和null用作标识符. js中的关键字可用于表示控制语句的开始或结束,或者用于执行特定操作等.按照规则,关键字也是语言保留的,不能用作标识符.以下就是ECMA ...
- Discuz对不起,您安装的不是正版应用的解决办法
方法三(2014年新增最简单方法.) .打开/source /function/function_cloudaddons.php这个文件,2.搜索:cloudaddons_validator,3.一般 ...
- 使用 WinAppDeployCmd 部署Win10 App 到移动设备
WinAppDeployCmd是目前微软提供的Win10 App 部署工具,它和以前的Windows Phone Application Deployment 部署工具有所不同的是,WinAppDep ...