共用方式為


ConventionModelExtensions.SetChangeTrackingStrategy 方法

定義

設定要用於模型中實體的預設變更追蹤策略。 此策略指出內容如何偵測實體類型實例的屬性變更。

public static void SetChangeTrackingStrategy (this Microsoft.EntityFrameworkCore.Metadata.IConventionModel model, Microsoft.EntityFrameworkCore.ChangeTrackingStrategy? changeTrackingStrategy, bool fromDataAnnotation = false);
public static Microsoft.EntityFrameworkCore.ChangeTrackingStrategy? SetChangeTrackingStrategy (this Microsoft.EntityFrameworkCore.Metadata.IConventionModel model, Microsoft.EntityFrameworkCore.ChangeTrackingStrategy? changeTrackingStrategy, bool fromDataAnnotation = false);
static member SetChangeTrackingStrategy : Microsoft.EntityFrameworkCore.Metadata.IConventionModel * Nullable<Microsoft.EntityFrameworkCore.ChangeTrackingStrategy> * bool -> unit
static member SetChangeTrackingStrategy : Microsoft.EntityFrameworkCore.Metadata.IConventionModel * Nullable<Microsoft.EntityFrameworkCore.ChangeTrackingStrategy> * bool -> Nullable<Microsoft.EntityFrameworkCore.ChangeTrackingStrategy>
<Extension()>
Public Sub SetChangeTrackingStrategy (model As IConventionModel, changeTrackingStrategy As Nullable(Of ChangeTrackingStrategy), Optional fromDataAnnotation As Boolean = false)
<Extension()>
Public Function SetChangeTrackingStrategy (model As IConventionModel, changeTrackingStrategy As Nullable(Of ChangeTrackingStrategy), Optional fromDataAnnotation As Boolean = false) As Nullable(Of ChangeTrackingStrategy)

參數

model
IConventionModel

要設定預設變更追蹤策略的模型。

changeTrackingStrategy
Nullable<ChangeTrackingStrategy>

要使用的策略。

fromDataAnnotation
Boolean

指出是否已使用資料批註指定組態。

傳回

已設定的值。

適用於