PersistenceProvider.BeginLoadIfChanged(TimeSpan, Object, AsyncCallback, Object) 方法

定义

在派生类中实现时,表示“LoadIfChanged”阶段开始。When implemented in a derived class, represents the beginning of the LoadIfChanged phase. 将状态数据从持久性存储区加载到永久性提供程序中,并且持久性存储区中的状态数据已更改时,将进入“LoadIfChanged”阶段。The LoadIfChanged phase occurs when state data is loaded into the persistence provider from the persistence store, and the state data in the persistence store has been changed.

public:
 virtual IAsyncResult ^ BeginLoadIfChanged(TimeSpan timeout, System::Object ^ instanceToken, AsyncCallback ^ callback, System::Object ^ state);
public virtual IAsyncResult BeginLoadIfChanged (TimeSpan timeout, object instanceToken, AsyncCallback callback, object state);
abstract member BeginLoadIfChanged : TimeSpan * obj * AsyncCallback * obj -> IAsyncResult
override this.BeginLoadIfChanged : TimeSpan * obj * AsyncCallback * obj -> IAsyncResult
Public Overridable Function BeginLoadIfChanged (timeout As TimeSpan, instanceToken As Object, callback As AsyncCallback, state As Object) As IAsyncResult

参数

timeout
TimeSpan

时间段,永久性提供程序在该时间段后将中止此尝试。The time period after which the persistence provider aborts this attempt.

instanceToken
Object

先前的 Create(Object, TimeSpan)Update(Object, TimeSpan) 返回的标记,表示调用方具有的当前状态。The token returned by a previous Create(Object, TimeSpan) or Update(Object, TimeSpan) that represents the current state held by the caller.

callback
AsyncCallback

操作完成时将要调用的方法。The method to be called when the operation is completed.

state
Object

一个用户提供的对象,该对象用于将此特定异步操作与其他操作区别开来。A user-provided object that distinguishes this particular asynchronous operation from other operations.

返回

IAsyncResult

BeginLoadIfChanged(TimeSpan, Object, AsyncCallback, Object) 异步方法调用的状态。The state of the BeginLoadIfChanged(TimeSpan, Object, AsyncCallback, Object) asynchronous method call.

示例

下面的代码演示如何实现 BeginLoadIfChanged 方法。The following code demonstrates how to implement the BeginLoadIfChanged method.

public override IAsyncResult BeginLoadIfChanged(TimeSpan timeout, object instanceToken, AsyncCallback callback, object state)
{
    base.ThrowIfDisposedOrNotOpen();
    return this.factory.BeginLoad(this.Id, timeout, callback, state);
}

适用于