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

指示配置是否是使用数据注释指定的。

返回

配置的值。

适用于