共用方式為


WorkflowPersistenceService.RestoreFromDefaultSerializedForm 方法

定義

從其序列化表單中還原 Activity

protected:
 static System::Workflow::ComponentModel::Activity ^ RestoreFromDefaultSerializedForm(cli::array <System::Byte> ^ activityBytes, System::Workflow::ComponentModel::Activity ^ outerActivity);
protected static System.Workflow.ComponentModel.Activity RestoreFromDefaultSerializedForm (byte[] activityBytes, System.Workflow.ComponentModel.Activity outerActivity);
static member RestoreFromDefaultSerializedForm : byte[] * System.Workflow.ComponentModel.Activity -> System.Workflow.ComponentModel.Activity
Protected Shared Function RestoreFromDefaultSerializedForm (activityBytes As Byte(), outerActivity As Activity) As Activity

參數

activityBytes
Byte[]

Activity 的序列化表單。

outerActivity
Activity

外部 Activity,其中包含要還原的 Activity

傳回

還原的 Activity

範例

下列範例示範 RestoreFromDefaultSerializedForm 方法的實作。 這個範例來自 FilePersistenceService.cs 檔案中的<自訂持續性服務>範例。 如需詳細資訊,請參閱 自訂持續性服務範例

// Load the completed activity state.
protected override Activity LoadCompletedContextActivity(Guid activityId, Activity outerActivity)
{
    Console.WriteLine("Loading completed activity context: {0}", activityId);
    byte[] workflowBytes = DeserializeFromFile(activityId);
    Activity deserializedActivities = WorkflowPersistenceService.RestoreFromDefaultSerializedForm(workflowBytes, outerActivity);
    return deserializedActivities;
}
' Load completed activity state.
Protected Overrides Function LoadCompletedContextActivity(ByVal scopeId As System.Guid, ByVal outerActivity As System.Workflow.ComponentModel.Activity) As System.Workflow.ComponentModel.Activity
    Console.WriteLine("Loading completed activity context: 0}", scopeId)
    Dim workflowBytes As Byte() = DeserializeFromFile(scopeId)
    Dim deserializedActivities As Activity = WorkflowPersistenceService.RestoreFromDefaultSerializedForm(workflowBytes, outerActivity)
    Return deserializedActivities
End Function

適用於