验证失败后用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.的更多相关文章

  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' property for more details.

    Validation failed for one or more entities. See 'EntityValidationErrors' property for more details. ...

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

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

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

  5. EF中,保存实体报错:Validation failed for one or more entities. 如何知道具体错误在哪?

    异常提示:Validation failed for one or more entities. See 'EntityValidationErrors' property for more deta ...

  6. vs报错找不到错在哪里!Validation failed for one or more entities

    今天在处理Entity Framework修改数据库时,报错: Validation failed for one or more entities. See 'EntityValidationErr ...

  7. Entity Framework插入数据报错:Validation failed for one or more entities

    www.111cn.net 编辑:lanve 来源:转载 今天在处理Entity Framework插入数据库时,报错: Validation failed for one or more entit ...

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

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

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

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

随机推荐

  1. windows下Python shell代码自动补全

    Unix下实现如题功能用下面的代码: import rlcompleter, readline readline.parse_and_bind('tab: complete') 但readline不能 ...

  2. 19、lambda表达式树

    一.定义: 表达式树又称为表达式目录树,以数据形式表示语言级代码.所有的数据都存储在树结构中,每个结点表示一个表达式(Expression). 二.要点: –Lambda表达式的参数类型可以忽略,因为 ...

  3. LayaAir引擎——(二)

    LayaAir引擎 -> 工具 -> 图集打包例子

  4. Java(三)

    任意整数求和: (1) import java.util.Scanner; public class sum { @SuppressWarnings("resource") pub ...

  5. XML代码生成器——XMLFACTORY 简介(二)

    XML代码生成器——XMLFACTORY 简介(二)      因为春节和项目上线的原因,离写上一篇文章的时间已经好久了. 不知道是事情太多了,还是自已效率太低了.总之是时间不够用. 哎,苦逼的程序员 ...

  6. LinQ递归查询

    --由父项递归下级 with cte(refid,pid,zname,code) as (--父项 union all --递归结果集中的下级 select t.refid,t.pid,t.zname ...

  7. About SCCM 2012 UDA(User Device Affinity)

    Two useful articles about UDA: http://fbinotto.blogspot.com/2011/09/sccm-2012-user-device-affinity.h ...

  8. 网络虚拟化中的 offload 技术:LSO/LRO、GSO/GRO、TSO/UFO、VXLAN

    offload 现在,越来越多的网卡设备支持 offload 特性,来提升网络收/发性能.offload 是将本来该操作系统进行的一些数据包处理(如分片.重组等)放到网卡硬件中去做,降低系统 CPU ...

  9. LintCode Subarray Sum

    For this problem we need to learn a new trick that if your start sum up all elements in an array. Wh ...

  10. UE4 VR 模式画面扭曲 解决方法

    后期处理盒子 详细设置->setting->Misc->screen percentage 设置为100