WorkflowPersistenceService.RestoreFromDefaultSerializedForm Method (Byte[], Activity)

 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Restores the Activity from its serialized form.

Namespace:   System.Workflow.Runtime.Hosting
Assembly:  System.Workflow.Runtime (in System.Workflow.Runtime.dll)

protected static Activity RestoreFromDefaultSerializedForm(
	byte[] activityBytes,
	Activity outerActivity
)

Parameters

activityBytes
Type: System.Byte[]

The serialized form of Activity.

outerActivity
Type: System.Workflow.ComponentModel.Activity

The outer Activity, containing the Activity to restore.

Return Value

Type: System.Workflow.ComponentModel.Activity

The restored Activity.

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;

}

.NET Framework
Available since 3.0
Return to top
Show: