語言

IConventionProperty.SetBeforeSaveBehavior 方法

定義

設定一個值,表示該屬性是否能在實體儲存到資料庫前被修改。

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

參數

beforeSaveBehavior
Nullable<PropertySaveBehavior>

一個表示該屬性是否能在實體儲存到資料庫前被修改的值。 null 重置為預設值。

fromDataAnnotation
Boolean

表示配置是否以資料註解方式指定。

傳回

設定值。

備註

若 Throw,則當該屬性在狀態中 Added 被賦值時,將拋出異常。

若 Ignore,則任何值集合在狀態 Added 下都會被忽略。

適用於