Share via


WorkflowApplication.Unload 메서드

정의

워크플로 인스턴스를 지속하거나 언로드합니다.

오버로드

Unload(TimeSpan)

지정한 시간 제한 간격을 사용하여 워크플로 인스턴스를 지속하고 언로드합니다.

Unload()

워크플로 인스턴스를 지속하거나 언로드합니다.

설명

기본적으로 언로드 작업은 30초 안에 완료되어야 합니다. 그렇지 않으면 TimeoutException 이 throw됩니다.

워크플로 instance 이전에 지속성에서 로드된 경우 워크플로를 로드하는 데 사용된 것과 동일한 InstanceStore 가 지속성에 사용됩니다. 워크플로가 만들어지고 아직 유지되지 않은 경우 이 메서드를 InstanceStore 호출하기 전에 를 구성해야 합니다. 그렇지 않으면 InvalidOperationException 이 메서드를 호출할 때 이 throw됩니다.

Unload(TimeSpan)

지정한 시간 제한 간격을 사용하여 워크플로 인스턴스를 지속하고 언로드합니다.

public:
 void Unload(TimeSpan timeout);
public void Unload (TimeSpan timeout);
member this.Unload : TimeSpan -> unit
Public Sub Unload (timeout As TimeSpan)

매개 변수

timeout
TimeSpan

작업이 취소되고 TimeoutException이 throw되기 전에 언로드 작업을 완료해야 하는 간격입니다.

예제

이 예제에서는 워크플로가 유휴 상태이고 호스트 애플리케이션이 사용자 입력을 기다리고 있습니다. 사용자가 언로드를 선택하는 경우 가 Unload 호출됩니다. 성공하면 워크플로가 메모리에서 유지되고 언로드됩니다.

// single interaction with the user. The user enters a string in the console and that
// string is used to resume the ReadLine activity bookmark
static void Interact(WorkflowApplication application, AutoResetEvent resetEvent)
{
    Console.WriteLine("Workflow is ready for input");
    Console.WriteLine("Special commands: 'unload', 'exit'");

    bool done = false;
    while (!done)
    {
        Console.Write("> ");
        string s = Console.ReadLine();
        if (s.Equals("unload"))
        {
            try
            {
                // attempt to unload will fail if the workflow is idle within a NoPersistZone
                application.Unload(TimeSpan.FromSeconds(5));
                done = true;
            }
            catch (TimeoutException e)
            {
                Console.WriteLine(e.Message);
            }
        }
        else if (s.Equals("exit"))
        {
            application.ResumeBookmark("inputBookmark", s);
            done = true;
        }
        else
        {
            application.ResumeBookmark("inputBookmark", s);
        }
    }
    resetEvent.WaitOne();
}

설명

워크플로 instance 이전에 지속성에서 로드된 경우 워크플로를 로드하는 데 사용된 것과 동일한 InstanceStore 가 지속성에 사용됩니다. 워크플로가 만들어지고 아직 유지되지 않은 경우 이 메서드를 InstanceStore 호출하기 전에 를 구성해야 합니다. 그렇지 않으면 InvalidOperationException 이 메서드를 호출할 때 이 throw됩니다.

적용 대상

Unload()

워크플로 인스턴스를 지속하거나 언로드합니다.

public:
 void Unload();
public void Unload ();
member this.Unload : unit -> unit
Public Sub Unload ()

예제

이 예제에서는 워크플로가 유휴 상태이고 호스트 애플리케이션이 사용자 입력을 기다리고 있습니다. 사용자가 언로드를 선택하는 경우 가 Unload 호출됩니다. 성공하면 워크플로가 메모리에서 유지되고 언로드됩니다.

// single interaction with the user. The user enters a string in the console and that
// string is used to resume the ReadLine activity bookmark
static void Interact(WorkflowApplication application, AutoResetEvent resetEvent)
{
    Console.WriteLine("Workflow is ready for input");
    Console.WriteLine("Special commands: 'unload', 'exit'");

    bool done = false;
    while (!done)
    {
        Console.Write("> ");
        string s = Console.ReadLine();
        if (s.Equals("unload"))
        {
            try
            {
                // attempt to unload will fail if the workflow is idle within a NoPersistZone
                application.Unload(TimeSpan.FromSeconds(5));
                done = true;
            }
            catch (TimeoutException e)
            {
                Console.WriteLine(e.Message);
            }
        }
        else if (s.Equals("exit"))
        {
            application.ResumeBookmark("inputBookmark", s);
            done = true;
        }
        else
        {
            application.ResumeBookmark("inputBookmark", s);
        }
    }
    resetEvent.WaitOne();
}

설명

기본적으로 언로드 작업은 30초 안에 완료되어야 합니다. 그렇지 않으면 TimeoutException 이 throw됩니다.

워크플로 instance 이전에 지속성에서 로드된 경우 워크플로를 로드하는 데 사용된 것과 동일한 InstanceStore 가 지속성에 사용됩니다. 워크플로가 만들어지고 아직 유지되지 않은 경우 이 메서드를 InstanceStore 호출하기 전에 를 구성해야 합니다. 그렇지 않으면 InvalidOperationException 이 메서드를 호출할 때 이 throw됩니다.

적용 대상