Type of issue
Code doesn't work
Description
The "Overriding value generation" code sample doesn't appear to work correctly. When using ValueGeneratedOnAddOrUpdate, it won't save an explicit value. I had to use ValueGeneratedOnAdd instead to get it to auto-generate a value when none supplied and still save explicitly set property values.
See also this guide, which explains how ValueGeneratedOnAddOrUpdate and ValueGeneratedOnAdd behave differently when setting explict values: https://www.learnentityframeworkcore.com/model/generated-value
Page URL
https://learn.microsoft.com/en-us/ef/core/modeling/generated-properties?tabs=fluent-api
Content source URL
https://github.com/dotnet/EntityFramework.Docs/blob/main/entity-framework/core/modeling/generated-properties.md
Document Version Independent Id
ec833af2-275e-981f-689f-8c65edfc00cd
Article author
@AndriySvyryd
Type of issue
Code doesn't work
Description
The "Overriding value generation" code sample doesn't appear to work correctly. When using ValueGeneratedOnAddOrUpdate, it won't save an explicit value. I had to use ValueGeneratedOnAdd instead to get it to auto-generate a value when none supplied and still save explicitly set property values.
See also this guide, which explains how ValueGeneratedOnAddOrUpdate and ValueGeneratedOnAdd behave differently when setting explict values: https://www.learnentityframeworkcore.com/model/generated-value
Page URL
https://learn.microsoft.com/en-us/ef/core/modeling/generated-properties?tabs=fluent-api
Content source URL
https://github.com/dotnet/EntityFramework.Docs/blob/main/entity-framework/core/modeling/generated-properties.md
Document Version Independent Id
ec833af2-275e-981f-689f-8c65edfc00cd
Article author
@AndriySvyryd