LinqDataSource.EnableObjectTracking 属性

定义

获取或设置一个值,该值指示是否跟踪对数据上下文对象所做的更改。Gets or sets the value that indicates whether changes to the data context object are tracked.

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

属性值

Boolean

如果跟踪数据上下文对象的更改,则为 true;否则为 falsetrue if the data context object is tracked for changes; otherwise, false. 默认值为 trueThe default is true.

注解

EnableObjectTracking 属性仅在从 LINQ TO SQL 数据上下文对象选择数据时使用。The EnableObjectTracking property is only used when selecting data from a LINQ To SQL data context object.

与只读数据交互时,将 EnableObjectTracking 属性设置为可 false 提高性能,因为数据不会进行缓存以确定其是否已更改。When you are interacting with read-only data, setting the EnableObjectTracking property to false improves performance because the data is not cached to determine if it has changed. 但是,它还禁用延迟的查询执行。However, it also disables deferred query execution. true如果要使用延迟的查询执行,则必须将此属性设置为。This property must be set to true if you want to use deferred query execution.

适用于

另请参阅