摘自:http://www.cnblogs.com/douqiumiao/default.aspx?opt=msg

Validation failed for one or more entities. See ‘EntityValidationErrors’ property for moredetails. Unfortunately there is no further information about

关于如何查看 EntityValidationErrors 详细信息的解决方法

我们在 EF 的编程中,有时候会遇到这样一个错误:

但是,按照他的提示 “See 'EntityValidationErrors' property for more details.” 去 Exception 中查看,却只能看到

并不能看到具体的是那个属性为什么验证不通过,也许不少人都遇到这种情况。

这里给大家介绍一个Exception类,让我们能够轻松的知道具体的哪一个字段出了什么问题。

那就是 System.Data.Entity.Validation.DbEntityValidationException,相信代码都知道怎么写了,最简单的就是

try
{
// 写数据库
}
catch (DbEntityValidationException dbEx)
{ }

在 dbEx 里面中我们就可以看到

这样子我们就能看到 EntityValidationErrors 所有的 ValidationErrors 的详细信息了。

Validation failed for one or more entities. See ‘EntityValidationErrors’解决方法【转载】的更多相关文章

  1. Validation failed for one or more entities. See ‘EntityValidationErrors’解决方法

    Validation failed for one or more entities. See ‘EntityValidationErrors’解决方法 You can extract all the ...

  2. Validation failed for one or more entities. See ‘EntityValidationErrors’解决方法;关于如何查看 EntityValidationErrors 详细信息的解决方法

    我们在 EF 的编程中,有时候会遇到这样一个错误: 但是,按照他的提示 "See 'EntityValidationErrors' property for more details.&qu ...

  3. 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. ...

  4. “Validation failed for one or more entities”异常的解决办法

    日志中出现Entity Framework修改数据库时的错误: Validation failed for one or more entities. See 'EntityValidationErr ...

  5. 报错:Validation failed for one or more entities. See 'EntityValidationErrors' property for more details.

    在保存数据的时候报这个错误,知道是验证错误,但到底是哪个属性验证错误呢? →打断点,运行,观察程序出错的地方→在出错的部分添加try...catch语句块→添加监视,输入((System.Data.E ...

  6. Validation failed for one or more entities. See ‘EntityValidationErrors’ property for moredetails[转]

    这里给大家介绍一个Exception类,让我们能够轻松的知道具体的哪一个字段出了什么问题. 那就是 System.Data.Entity.Validation.DbEntityValidationEx ...

  7. Entity Framework插入数据报错:Validation failed for one or more entities. See 'EntityValidationErrors' property for more details.

    stackoverflow的解决方法 try { db.Entity.Add(entity); db.SaveChanges(); } catch (DbEntityValidationExcepti ...

  8. 关于在ASP.NET MVC 中使用EF的Code First的方式来读取数据库时的Validation failed for one or more entities. See 'EntityValidationErrors' property for more details.

    今天在做一个小网站的时候遇到很多问题唉,我还是个菜鸟,懂的也不多,今天一个表单的提交按钮用不了,都弄了几个小时唉.不过最后还是搞定了,还有浏览器有开发人员选项,不然我都不知道我还要继续排查多久哦,今天 ...

  9. Validation failed for one or more entities. See ‘EntityValidationErrors’,一个或多个验证错误 解决方法

    try{// 写数据库}catch (DbEntityValidationException dbEx){ }在 dbEx 里面中我们就可以看到

随机推荐

  1. mysql查询结果导出到文件

    方法一: 直接执行命令: mysql> select count(1) from table   into outfile '/tmp/test.xls'; Query OK, 31 rows ...

  2. 前端AJAX传递数组给Springmvc接收处理

    前端传递数组后端(Spring)来接收并处理: <!DOCTYPE html> <html> <head> <meta charset="UTF-8 ...

  3. django rest framework csrf failed csrf token missing or incorrect

    django rest framework csrf failed csrf token missing or incorrect REST_FRAMEWORK = { 'DEFAULT_AUTHEN ...

  4. 51nod 1135 原根

    题目链接:51nod 1135 原根 设 m 是正整数,a是整数,若a模m的阶等于φ(m),则称 a 为 模m的一个原根.(其中φ(m)表示m的欧拉函数) 阶:gcd(a,m)=1,使得成立的最小的 ...

  5. Android开发--Intent的应用

    1.概述 Intent负责对应用中一次操作的动作,动作涉及的数据,附加的数据进行描述,起到媒介的作用.通过Intent对象指定一个activity,利用startActivity或 startActi ...

  6. checkbox --jquery

    <input type="checkbox" value="2" class="ace ace-checkbox-2" id='ass ...

  7. hdu 1008 注意同层情况

    #include<iostream> using namespace std; int main() { int n; ]; while(cin>>n) { ,m=; ) br ...

  8. Top Five Hacker Tools Every CISO Should Understand

    As the role of the CISO continues to evolve within organizations towards that of an executive level ...

  9. Deprecated: Function split() is deprecated in ... 解决办法

    本地测试的程序上传到服务器出现很多错误,Deprecated: Function split() is deprecated  查了原因是因为PHP的版本不同所导致的,本身程序开发的时候用的是PHP5 ...

  10. enmo_day_07

    数据备份 物理备份 : 底层数据块 逻辑备份 :exp(export), imp(import) 导入导出工具,提取成dump文件,再将dump文件放入数据库 expdp, impdp 数据蹦 uti ...