异常描述:
 
捕捉到 System.Data.Entity.Infrastructure.DbUpdateException
  HResult=-2146233087
  Message=无法更新 EntitySet“CashRequest”,因为它有一个 DefiningQuery,而 <ModificationFunctionMapping> 元素中没有支持当前操作的 <InsertFunction> 元素。
  Source=EntityFramework
  StackTrace:
       在 System.Data.Entity.Internal.InternalContext.SaveChanges()
       在 System.Data.Entity.Internal.LazyInternalContext.SaveChanges()
       在 System.Data.Entity.DbContext.SaveChanges()
       在 Core.ServiceBase`1.Add(T entity) 位置 d:\WORK\LssNew\Core\ServiceBase.cs:行号 171
       在 Lss.App.Controllers.MechanicController.CashAction(Int32 WorkerID, Double CashNum) 位置 d:\WORK\LssNew\Lss.App\Controllers\MechanicController.cs:行号 1201
  InnerException: System.Data.Entity.Core.UpdateException
       HResult=-2146232032
       Message=无法更新 EntitySet“CashRequest”,因为它有一个 DefiningQuery,而 <ModificationFunctionMapping> 元素中没有支持当前操作的 <InsertFunction> 元素。
       Source=EntityFramework.SqlServer。
 
异常原因及处理: 数据库中该实体表无主键,设置主键后更新模型就解决

System.Data.Entity.Infrastructure.DbUpdateException的更多相关文章

  1. 报错:System.Data.Entity.Infrastructure.DbUpdateException 更新条目时出错

    背景 往数据库添加数据,前端验证通过的情况下,提交报错,程序停在了SaveChanges()这行,并报如上错误. 分析 猜想是提交的领域模型不符合数据库要求,但不知道具体哪里出错.网上查资料,有人发现 ...

  2. EF 更新数据出现 System.Data.Entity.Infrastructure.DbUpdateConcurrencyException: 异常

    EF6更新 数据出现 System.Data.Entity.Infrastructure.DbUpdateConcurrencyException: Store update, insert, or  ...

  3. system.Data.Entity.Infrastructure.DbUpdateConcurrencyException: Store update, insert, or delete statement affected an unexpected number of rows (0) 问题

    页面控件没有做限制.提交后还可以继续点击,造成了在短时间内的多次请求.查看日志两次错误在200ms之内. 错误信息 system.Data.Entity.Infrastructure.DbUpdate ...

  4. ef添加数据时出错 System.Data.Entity.Infrastructure.DbUpdateConcurrencyException”类型的异常

    找半天才找到 ef添加数据时出错原因:数据库表中没有主键 ,就算表中有自增列 Added方法也会报错: -        this._db.SaveChanges() “this._db.SaveCh ...

  5. code first System.Data.Entity.Infrastructure.CommitFailedException: An error was reported while committing a database transaction but it could not be determined whether the transaction succeeded

    System.Data.Entity.Infrastructure.CommitFailedException: An error was reported while committing a da ...

  6. .net mvc System.Web.Optimization 、System.Data.Entity.Infrastructure找不到

    在MVC4的开发中,如果在App_Start目录下BundleConfig.cs类没有找不到引用System.Web.Optimization,可以使用程序包管理控制台进行安装到使用的项目 打开 工具 ...

  7. Mysql EF 触发器生成主键id 存储区更新、插入或删除语句影响到了意外的行数(0)。实体在加载后可能被修改或删除。刷新 ObjectStateManager 项 ;System.Data.Entity.Infrastructure.DbUpdateConcurrencyException

    http://stackoverflow.com/questions/24725261/how-to-use-a-custom-identity-column-in-sql-with-entity-f ...

  8. 【model模型传入view的数据类型错误】传入字典的模型项的类型为“System.Data.Entity.Infrastructure.DbQuery`1[MapScience.PovertyAlleviation.Web.Models.Qu

    出现这个问题的原因是控制器中传给view的数据类型与View中设置的model类型不一致导致,比如控制器返回的IList类型的,而你在View里面model设置的是IEnumerable<> ...

  9. MVC开发中的常见错误-05-无法将类型“System.Data.Entity.Infrastructure.DbQuery<BBFJ.OA.Model.RoleInfo>”转换为“System.Collections.Generic.List<BBFJ.OA.Model.RoleInfo>”

    List<RoleInfo> roleInfoList = (List<RoleInfo>)ViewBag.AllRoles; 错误原因很明确了 ViewBag.AllRole ...

随机推荐

  1. git clean 删除忽略文件 和 未被跟踪文件及文件夹

    git clean 删除忽略文件 和 未被跟踪文件及文件夹 概念 首先我们需要认清 忽略的文件 和 未被跟踪的文件 忽略的文件:.gitignore 中忽略的文件 未被跟踪的文件:没有被忽略,但是还没 ...

  2. Unreal 4 error 记录

    1.打包出来的exe,黑屏 这种最大的可能是在“地图&模式中”将 Default Maps设置为自己的map,注意这里分为Editor Startup Map和Game Default Map ...

  3. jQuery AJAX相关方法

    接jQuery学习上篇.因为AJAX是相对独立的一块,所以和jQuery的随笔分开记录了.素材同样来自runoob. 先了解下什么是AJAX. AJAX = 异步 JavaScript 和 XML(A ...

  4. dotnetcore Http服务器研究(一)

    自从dotnet core 诞生以来,发展非常强势.我们总有些需要写一个独立的http服务器的需求,我想是时候忘记httplistener 了. dotnet framework 时代建一个小的htt ...

  5. Android像素密度单位解析

    Android应用程序 res/drawable-hdpi drawable-xxhdpi 显示的不同 对比实验: 创建项目后,默认在相关文件目录中生成以下图标: hdpi --> 72px m ...

  6. Matlab调用遗传工具箱复现论文模型求解部分

    原文转载自:https://blog.csdn.net/robert_chen1988/article/details/52431594 论文来源: https://www.sciencedirect ...

  7. STS(Spring Tool Suite)下SSM(Spring+SpringMVC+Mybatis)框架搭建(一)

    最近在用SSM框架做一个网站,就顺便把自己要做的笔记需要了解的东西都写了下来,看看对大家学习SSM框架有没有帮助. 开发环境: 1.win10 64位 2.spring-tool-suite-3.9. ...

  8. HTML入门12

    开始了解响应式图片 响应式,根据屏幕尺寸和分辨率的设备上都能良好工作以及其他特性的图片,接下来考虑怎样创建自适应得图片,专注于img元素,完成自适应. 分辨率切换,不同的尺寸 <img srcs ...

  9. [LeetCode] Positions of Large Groups 大群组的位置

    In a string S of lowercase letters, these letters form consecutive groups of the same character. For ...

  10. 在IIS上新发布的网站,样式与js资源文件加载不到(资源文件和网页同一个域名下)

    在IIS上新发布的网站,网站能打开,但样式与js资源文件加载不到(资源文件和网页是同一个域名下,例如:网页www.xxx.com/index.aspx,图片www.xxx.com/pic.png). ...