Partager via


WorkflowPersistenceService.RestoreFromDefaultSerializedForm Méthode

Définition

Restaure Activity depuis sa forme sérialisée.

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

Paramètres

activityBytes
Byte[]

Forme sérialisée de Activity.

outerActivity
Activity

Classe Activityexterne, contenant la classe Activity à restaurer.

Retours

Activity

Activity restauré.

Exemples

L'exemple suivant illustre une implémentation de la méthode RestoreFromDefaultSerializedForm. Il provient de l'exemple de Custom Persistence Service, dans le fichier FilePersistenceService.cs. Pour plus d’informations, consultez l’exemple de service de persistance personnalisé.

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

S’applique à