Share via


IConventionPropertyBuilder.ValueGenerated Method

Definition

Sets a value indicating when a value for this property will be generated by the database. Even when the 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 the entity is added and a value is assigned, or the property is marked as modified for an existing entity. See GetBeforeSaveBehavior() and GetAfterSaveBehavior() for more information and examples.

public Microsoft.EntityFrameworkCore.Metadata.Builders.IConventionPropertyBuilder ValueGenerated (Microsoft.EntityFrameworkCore.Metadata.ValueGenerated? valueGenerated, bool fromDataAnnotation = false);
public Microsoft.EntityFrameworkCore.Metadata.Builders.IConventionPropertyBuilder? ValueGenerated (Microsoft.EntityFrameworkCore.Metadata.ValueGenerated? valueGenerated, bool fromDataAnnotation = false);
abstract member ValueGenerated : Nullable<Microsoft.EntityFrameworkCore.Metadata.ValueGenerated> * bool -> Microsoft.EntityFrameworkCore.Metadata.Builders.IConventionPropertyBuilder
Public Function ValueGenerated (valueGenerated As Nullable(Of ValueGenerated), Optional fromDataAnnotation As Boolean = false) As IConventionPropertyBuilder

Parameters

valueGenerated
Nullable<ValueGenerated>

A value indicating when a value for this property will be generated by the database. null to reset to default.

fromDataAnnotation
Boolean

Indicates whether the configuration was specified using a data annotation.

Returns

The same builder instance if the requiredness was configured, null otherwise.

Applies to