WorkflowPersistenceService.RestoreFromDefaultSerializedForm Method

Definition

Restores the Activity from its serialized form.

protected static System.Workflow.ComponentModel.Activity RestoreFromDefaultSerializedForm (byte[] activityBytes, System.Workflow.ComponentModel.Activity outerActivity);

Parameters

activityBytes
Byte[]

The serialized form of Activity.

outerActivity
Activity

The outer Activity, containing the Activity to restore.

Returns

The restored Activity.

Examples

The following example demonstrates an implementation of the RestoreFromDefaultSerializedForm method. This example is from the Custom Persistence Service sample, from the FilePersistenceService.cs file. For more information, see Custom Persistence Service Sample.

// 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;
}

Applies to

Produkt Versjoner
.NET Framework 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1