ValueGenerated Enum

Definition

Indicates when a value for a property will be generated by the database.

Even when a property is set to be generated by the database, EF may still attempt to save a specific value (rather than having one generated by the database) when an entity is added and a value is assigned, or the property is marked as modified for an existing entity. See PropertySaveBehavior for more details.

This enumeration has a FlagsAttribute attribute that allows a bitwise combination of its member values.

[System.Flags]
public enum ValueGenerated
type ValueGenerated = 
Public Enum ValueGenerated
Inheritance
ValueGenerated
Attributes

Fields

Never 0

A value is never generated by the database.

OnAdd 1

A value is generated by the database when an entity is first added to the database. The most common scenario for this is generated primary key values.

OnAddOrUpdate 3

A value is read from the database when the entity is first added and whenever the entity is subsequently updated. This is typically used for computed columns and scenarios such as rowversions, timestamps, etc.

OnUpdate 2

No value is generated when the entity is first added to the database, but a value will be read from the database whenever the entity is subsequently updated.

Applies to