- c - 在位数组中找到第一个零
- linux - Unix 显示有关匹配两种模式之一的文件的信息
- 正则表达式替换多个文件
- linux - 隐藏来自 xtrace 的命令
我将 EF 与 SQL Server 数据库一起使用。我为该 View 创建了一个 View 和一个 Instead Of Insert
触发器,如下所示:
insert into Target (value, someFk)
select value, 4 from inserted
select id from Target where @@ROWCOUNT > 0 and id = scope_identity()
我将 View 映射到 EF edmx。当我尝试添加实体时,调用 SaveChanges()
时出现以下异常:
Unable to update the EntitySet 'TargetView' because it has a DefiningQuery and no element exists in the element to support the current operation.
View 在映射中标记了标识列。
有什么建议吗?
最佳答案
如果您使用 xml 编辑器打开 EDMX 文件,在定义 TargetView 的部分您将有一些类似于以下的 xml;
<EntitySet Name=".."
EntityType=".."
store:Type="Views"
store:Schema=".."
store:Name="..">
<DefiningQuery>SELECT ....</DefiningQuery>
您需要更改此 xml 部分才能进行 CRUD 操作;
<EntitySet Name=".."
EntityType=".."
store:Type="Tables"
Schema=".." />
关于c# - 带有 Instead Of 触发器的 Entity Framework ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12217169/
我有一个不允许换行的多行 EditText。现在,只要他们点击保存,我就会用一些空格替换返回。有什么办法可以用完成按钮替换屏幕上的输入按钮? (就像单行 EditText 一样) 我知道我仍然应该去掉
我有这段代码用于从长度为 k 的数组中查找 n 个组合: class Util { // Function to print all distinct combinations of leng
我有一个客户。 CREATE TABLE `customer` ( `cNic` VARCHAR(50) NOT NULL DEFAULT '', `cName` VARCHAR(10
有没有人有一个简单的例子来解释为什么人们想要使用 Oracle instead of trigger ? 最佳答案 我见过几种不同的场景 1) 您使用初始数据模型构建一个系统,并为应用程序提供一组 V
您会在我的 form 标记中看到,我正在使用 toLocaleString 在我的最终输出中放置一个分隔符。但是我想要一个空格而不是逗号。我怎样才能做到这一点? 现在,第三个输出中有一个逗号。但理想情
我正在尝试创建一个考虑历史的数据库(经验表明你总有一天会这样做)。 我在这里问过database-design-how-to-handle-the-archive-problem但没有比链接 here
我将伪元素 :after 应用于章节标题类,但由于某种原因它出现在行的顶部而不是行的下方(我正在尝试创建下划线)。 HTML:
在我的 MySQL 数据库中,我有字段 DECIMAL(23,5),所以小数点后有 5 位数字。现在,当我这样查询时: UPDATE my_table SET my_decimal_field = 1
我正在尝试验证一个字段以查看该值是整数还是数组。下面的规则检查值是否为整数 AND 数组。 'field' => "integer|array", 最佳答案 如果你想使用OR,你需要创建一个custo
我正在对构建在 SQL Server 2000 上的遗留应用程序进行一些调整,不用说我只想做绝对最少的事情,因为担心它可能会全部崩溃。 我有一个很大的用户表 tbUsers,带有一个用于 IsDele
我在 SQL Server 2008 R2 下遇到以下超时问题,而不是删除触发器。它似乎仅在许多(> 6 左右)CustomFieldOption 时发生s 在同一个事务中被删除。 CREATE TR
在我的办公室,我们无法使用git://urls连接到github。对于常规存储库,我们只需使用https://url,就可以了。 对于要点,似乎没有一种通过https://URL访问要点的方法。 顺便
有这样的 Zend 查询: $select = $this->_table ->select() ->where('title LIKE
此代码生成一个具有 2 个 Y 轴和 1 个 X 轴的 Highcharts : $('#main_chart').highcharts({ chart: { zoom
Please bear with me here. I know there are other answers such as: AngularJS: Service vs provider vs
我在表上使用 INSTEAD OF 插入触发器来设置该行的递增版本号,并将该行复制到第二个历史/审核表。 这些行已毫无问题地插入到两个表中。 但是,我无法将第一个表中的新身份返回给用户。 架构 CRE
我正在开发新软件时对现有数据库进行更改。还有相当多使用数据库的遗留软件需要继续工作,即我想维护现有的数据库表、过程等。 目前我有 table CREATE TABLE dbo.t_station (
使用 MSSQL2008。 我有两张 table 。 TableResource ------------- ID [bigint] Attribute1 [int] Attribute2 [int]
我们正在执行到 SQL Server 的数据库迁移,为了支持旧版应用程序,我们在 SQL Server 表上定义了 View ,这些 View 按照旧版应用程序的预期显示数据。 但是,当字段可能具有默
在 examples page当您搜索(CTRL+F)图片库并单击第一张图片时,您可以使用下一个/上一个箭头浏览此图片库。它们之间的动画是垂直的——图像垂直飞行。如何让它们水平飞行? 在我找到的帮助中
我是一名优秀的程序员,十分优秀!