zoukankan      html  css  js  c++  java
  • 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.

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

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

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

    }

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

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

  • 相关阅读:
    harbor docker
    dns服务器
    k8s
    frps
    svn 搭建
    phpstrom 破解 转载https://www.jianshu.com/p/e71361b3bfee
    公开课
    k8s
    rsync各种备份
    定时任务
  • 原文地址:https://www.cnblogs.com/wangguowen27/p/EntityValidationErrors_net.html
Copyright © 2011-2022 走看看