語言

MutablePropertyExtensions.SetBeforeSaveBehavior 方法

定義

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

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

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

public static void SetBeforeSaveBehavior(this Microsoft.EntityFrameworkCore.Metadata.IMutableProperty property, Microsoft.EntityFrameworkCore.Metadata.PropertySaveBehavior? beforeSaveBehavior);
static member SetBeforeSaveBehavior : Microsoft.EntityFrameworkCore.Metadata.IMutableProperty * Nullable<Microsoft.EntityFrameworkCore.Metadata.PropertySaveBehavior> -> unit
<Extension()>
Public Sub SetBeforeSaveBehavior (property As IMutableProperty, beforeSaveBehavior As Nullable(Of PropertySaveBehavior))

參數

property
IMutableProperty

屬性。

beforeSaveBehavior
Nullable<PropertySaveBehavior>

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

適用於