DataContext.ObjectTrackingEnabled 屬性

定義

取得或設定值,指出物件追蹤是否已啟用。Gets or sets a value that indicates whether object tracking is enabled.

public:
 property bool ObjectTrackingEnabled { bool get(); void set(bool value); };
public bool ObjectTrackingEnabled { get; set; }
member this.ObjectTrackingEnabled : bool with get, set
Public Property ObjectTrackingEnabled As Boolean

屬性值

如果啟用物件追蹤,則為 true,否則為 falsetrue if the object tracking is enabled; otherwise, false. 預設為 trueThe default is true.

備註

設定此屬性可false改善抓取時的效能,因為要追蹤的專案較少。Setting this property to false improves performance at retrieval time, because there are fewer items to track.

會擲回例外狀況:An exception is thrown:

  • 如果在執行查詢之後, false將屬性設定為。If the property is set to false after a query has been executed.

    如需詳細資訊,請參閱中DataContext的「有效模式」一節。For more information, see the Valid Modes section in DataContext.

  • 如果屬性設定為false ,而且SubmitChanges會呼叫。If the property is set to false and SubmitChanges is called.

如果ObjectTrackingEnabledfalse false,則會DeferredLoadingEnabled忽略並視為。If ObjectTrackingEnabled is false, DeferredLoadingEnabled is ignored and treated as false. 在此情況下, DataContext是唯讀的。In this case, the DataContext is read-only.

如果ObjectTrackingEnabledtrue,則DeferredLoadingEnabled為。falseIf ObjectTrackingEnabled is true, DeferredLoadingEnabled is false. 在此情況下DataContext ,可讓您使用LoadWith指示詞載入物件圖形,但不會啟用延後載入。In this case, DataContext allows you to load an object graph by using LoadWith directives, but does not enable deferred loading.

適用於