StoreGeneratePattern 是什么意思?
我正在做EF设计,谁能告诉我StoreGeneratePattern
是什么意思?
我在网上找不到简单直接的答案。
I'm doing EF design, who could tell me what does StoreGeneratedPattern
mean?
I can't find a easy straight answer online.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您查看名为 枚举 它告诉如果插入或更新行应该做什么:
If you look at the samed called enumeration it tells what should be done if you insert or update rows:
这些答案也不是一个简单的直接答案,只是指向或重复OP所指的相同神秘文档。
当列由数据库计算时使用此属性。因此,在插入和更新时,该值将不会被写入。
该值将在插入和更新后从数据库中读回,但我猜测如果设置为
Identity
,EF 可能不会在更新后读取该值,因为它不会更改。我不知道它是否真的做出了微小的优化。一个示例可能是身份列或上次更新的时间戳。
These answers are also not an easy straight answer and just point to or repeat the same arcane documentation that the OP is referring to.
This attribute is used when the column is computed by the database. So on inserts and updates, the value will not be written.
The value will be read back from the database after inserts and updates, though I would guess that if set to
Identity
, EF may not read the value after an update since it won't have changed. Whether it really makes that tiny optimisation I don't know.An example might be an identity column or a last updated time-stamp.