Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make StoreGeneratedAlways the default for computed columms #7914

Closed
ajcvickers opened this issue Mar 16, 2017 · 0 comments
Closed

Make StoreGeneratedAlways the default for computed columms #7914

ajcvickers opened this issue Mar 16, 2017 · 0 comments
Labels
breaking-change closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. providers-beware type-enhancement
Milestone

Comments

@ajcvickers
Copy link
Member

Currently applications have to be careful not to mark properties that are "store generated on update" as modified because this will cause the modified value to be sent to the database which almost always causes an exception because updating the computed column is not allowed. This is why we had to introduce the StoreGeneratedAlways flag and set it for concurrency tokens--without it concurrency resolution was just too hard to do.

We should consider making this the default by convention for any property marked ValueGenerated.OnAddOrUpdate. This would match how most people want to use computed columns, while still allowing the ability to use the old behavior if somebody really wants it. Also, it would mean we no longer need to treat concurrency tokens differently. It would be technically a breaking change, but I doubt there is much (any?) real-world code that would break.

Also see #7913 which splits StoreGeneratedAlways into two flags and renames it.

@ajcvickers ajcvickers self-assigned this Mar 17, 2017
@ajcvickers ajcvickers added this to the 2.0.0 milestone Mar 17, 2017
@ajcvickers ajcvickers modified the milestones: 2.0.0-preview1, 2.0.0 Apr 19, 2017
@ajcvickers ajcvickers modified the milestones: 2.0.0, 2.0.0-preview2 May 15, 2017
ajcvickers added a commit that referenced this issue May 20, 2017
Part of issue #7913

This change obsoletes ReadOnlyBeforeSave, ReadOnlyAferSave, and StoreGeneratedAlways into two unified facets--one for before-save behavior (Added objects) and one for after-save behavior. In each case the property value can be:
- Ignore: value never sent to database. (Equivalent to StoreGeneratedAlways, but can apply to any property and can be set differently for before and after save.)
- Throw: any non-CLR default value set or property marked as modified causes exception. (Equivalent to previous read-only behaviors.)
- UseValue: the value is used if it has been set (to non-CLR default for store-generated) or marked as modified.

Also covers issue #7914 - makes Ignore the default for before and after save when using AddOrUpdate (computed) properties.
ajcvickers added a commit that referenced this issue May 20, 2017
Part of issue #7913

This change obsoletes ReadOnlyBeforeSave, ReadOnlyAferSave, and StoreGeneratedAlways into two unified facets--one for before-save behavior (Added objects) and one for after-save behavior. In each case the property value can be:
- Ignore: value never sent to database. (Equivalent to StoreGeneratedAlways, but can apply to any property and can be set differently for before and after save.)
- Throw: any non-CLR default value set or property marked as modified causes exception. (Equivalent to previous read-only behaviors.)
- UseValue: the value is used if it has been set (to non-CLR default for store-generated) or marked as modified.

Also covers issue #7914 - makes Ignore the default for before and after save when using AddOrUpdate (computed) properties.
ajcvickers added a commit that referenced this issue May 23, 2017
Part of issue #7913

This change obsoletes ReadOnlyBeforeSave, ReadOnlyAferSave, and StoreGeneratedAlways into two unified facets--one for before-save behavior (Added objects) and one for after-save behavior. In each case the property value can be:
- Ignore: value never sent to database. (Equivalent to StoreGeneratedAlways, but can apply to any property and can be set differently for before and after save.)
- Throw: any non-CLR default value set or property marked as modified causes exception. (Equivalent to previous read-only behaviors.)
- UseValue: the value is used if it has been set (to non-CLR default for store-generated) or marked as modified.

Also covers issue #7914 - makes Ignore the default for before and after save when using AddOrUpdate (computed) properties.
@ajcvickers ajcvickers added closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. and removed needs-design labels May 24, 2017
@ajcvickers ajcvickers modified the milestones: 2.0.0-preview2, 2.0.0 Oct 15, 2022
@ajcvickers ajcvickers removed their assignment Sep 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking-change closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. providers-beware type-enhancement
Projects
None yet
Development

No branches or pull requests

1 participant