开发者

What does StoreGeneratedPattern mean?

开发者 https://www.devze.com 2023-02-01 09:14 出处:网络
I\'m doing EF design, w开发者_Go百科ho could tell me what does StoreGeneratedPattern mean? I can\'t find a easy straight answer online.If you look at the samed called enumeration it tells what should

I'm doing EF design, w开发者_Go百科ho could tell me what does StoreGeneratedPattern mean?

I can't find a easy straight answer online.


If you look at the samed called enumeration it tells what should be done if you insert or update rows:

  • None: No auto generated value is generated
  • Identity: A new value is generated on insert, but not changed on update
  • Computed: A new value is generated on insert and update


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消