在自我跟踪实体中忽略计算的StoreGeneratedPattern? [英] Computed StoreGeneratedPattern Ignored in Self-Tracking Entities?

查看:69
本文介绍了在自我跟踪实体中忽略计算的StoreGeneratedPattern?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个带有非可空列的表,其中包含一个默认值(用于创建日期)。我创建了一个edmx,我已将StoreGeneratedPattern设置为'Computed'作为映射属性。 我正在使用自我跟踪实体。 当我插入这个STE时,我得到一个例外。 导致异常的原因是生成的insert语句尝试插入此列。 我的理解是,通过为要计算的属性设置StoreGeneratedPattern,它将从插入(或更新)中省略。
任何帮助都表示赞赏。

I have a table with a non-nullable column with a default value (used for create date). I have created an edmx, in which I have set the StoreGeneratedPattern to 'Computed' for the mapped property.  I am using self-tracking entities.  I get an exception when I go to insert this STE.  The exception is caused because the insert statement that was generated tries to insert into this column.  It was my understanding that by setting the StoreGeneratedPattern for the property to computed, it would be omitted from an insert (or update).
Any help is appreciated.

推荐答案

遗憾的是,该问题是"计算"的问题。需要在存储模型中设置属性,而不是实体模型。如果从模型生成数据库,则"计算"数据库将被生成。属性将被复制到存储模型。否则,您需要手动在SSDL上设置此属性,如果您运行"更新模型",它将会丢失。向导。

The issue, unfortunately, is that the "computed" property needs to be set in the storage model, not the entity model. If you generate the database from the model, then the "computed" property will be copied to the storage model. Otherwise, you'll need to set this property on the SSDL manually, and it will get lost if you run the "Update Model" wizard.

我们非常想在VS2010中解决这个问题,但结果证明在我们的时间范围内风险太大。

We very much wanted to fix this issue in VS2010, but it turned out to be too risky to do in the timeframe that we had.


这篇关于在自我跟踪实体中忽略计算的StoreGeneratedPattern?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆