What does StoreGeneratedPattern mean?
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.
精彩评论