Dela via


IConventionProperty.SetAfterSaveBehavior Method

Definition

Sets a value indicating whether this property can be modified after the entity is saved to the database.

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

Parameters

afterSaveBehavior
Nullable<PropertySaveBehavior>

Sets a value indicating whether this property can be modified after the entity is saved to the database. null to reset to default.

fromDataAnnotation
Boolean

Indicates whether the configuration was specified using a data annotation.

Returns

The configured value.

Remarks

If Throw, then an exception will be thrown if a new value is assigned to this property after the entity exists in the database.

If Ignore, then any modification to the property value of an entity that already exists in the database will be ignored.

Applies to