Share via


WorkflowRuntime 생성자

정의

WorkflowRuntime 클래스의 새 인스턴스를 초기화합니다.

오버로드

WorkflowRuntime()

WorkflowRuntime 클래스의 새 인스턴스를 초기화합니다.

WorkflowRuntime(String)

애플리케이션 구성 파일의 지정된 섹션을 사용하여 WorkflowRuntime 클래스의 새 인스턴스를 초기화합니다.

WorkflowRuntime(WorkflowRuntimeSection)

지정된 WorkflowRuntime의 설정을 사용하여 WorkflowRuntimeSection 클래스의 새 인스턴스를 초기화합니다.

WorkflowRuntime()

WorkflowRuntime 클래스의 새 인스턴스를 초기화합니다.

public:
 WorkflowRuntime();
public WorkflowRuntime ();
Public Sub New ()

예제

다음 코드 예제에서는 워크플로 호스트에서 WorkflowRuntime 기능을 사용하는 방법을 보여 줍니다. WorkflowRuntime 생성자를 사용하여 WorkflowRuntime의 인스턴스를 만들고 해당 메서드 및 이벤트에 액세스하는 방법의 예제를 제공합니다.

일부인이 코드 예제는 워크플로 취소 하면 샘플입니다.

static void Main()
{
    string connectionString = "Initial Catalog=SqlPersistenceService;Data Source=localhost;Integrated Security=SSPI;";

    using (WorkflowRuntime workflowRuntime = new WorkflowRuntime())
    {
        ExternalDataExchangeService dataService = new ExternalDataExchangeService();
        workflowRuntime.AddService(dataService);
        dataService.AddService(expenseService);

        workflowRuntime.AddService(new SqlWorkflowPersistenceService(connectionString));
        workflowRuntime.StartRuntime();

        workflowRuntime.WorkflowCompleted += OnWorkflowCompleted;
        workflowRuntime.WorkflowTerminated += OnWorkflowTerminated;
        workflowRuntime.WorkflowIdled += OnWorkflowIdled;
        workflowRuntime.WorkflowAborted += OnWorkflowAborted;

        Type type = typeof(SampleWorkflow1);
        WorkflowInstance workflowInstance = workflowRuntime.CreateWorkflow(type);
        workflowInstance.Start();

        waitHandle.WaitOne();

        workflowRuntime.StopRuntime();
    }
}
Shared Sub Main()
    Dim connectionString As String = "Initial Catalog=SqlPersistenceService;Data Source=localhost;Integrated Security=SSPI;"
    Using workflowRuntime As New WorkflowRuntime()
        Dim dataService As New ExternalDataExchangeService()
        workflowRuntime.AddService(dataService)
        dataService.AddService(expenseService)

        workflowRuntime.AddService(New SqlWorkflowPersistenceService(connectionString))


        AddHandler workflowRuntime.WorkflowCompleted, AddressOf OnWorkflowCompleted
        AddHandler workflowRuntime.WorkflowTerminated, AddressOf OnWorkflowTerminated
        AddHandler workflowRuntime.WorkflowIdled, AddressOf OnWorkflowIdled
        AddHandler workflowRuntime.WorkflowAborted, AddressOf OnWorkflowAborted


        Dim workflowInstance As WorkflowInstance
        workflowInstance = workflowRuntime.CreateWorkflow(GetType(SampleWorkflow))
        workflowInstance.Start()

        waitHandle.WaitOne()

        workflowRuntime.StopRuntime()
    End Using
End Sub

설명

WorkflowRuntime은 기본 속성 값으로 초기화되고 기본 핵심 서비스를 포함합니다. 워크플로 런타임 엔진을 추가로 구성하려는 경우 AddServiceRemoveService를 사용하여 서비스를 추가 및 제거할 수 있으며 Name을 설정할 수 있습니다. WorkflowRuntime이 구성된 후 StartRuntime을 호출하여 워크플로 런타임 엔진과 해당 서비스를 시작합니다.

다음 표에서는 WorkflowRuntime 클래스의 인스턴스에 대한 초기 속성 값을 보여 줍니다.

속성 초기 값
Name "WorkflowRuntime"
IsStarted false

기본 핵심 서비스는 DefaultWorkflowCommitWorkBatchServiceDefaultWorkflowSchedulerService입니다.

적용 대상

WorkflowRuntime(String)

애플리케이션 구성 파일의 지정된 섹션을 사용하여 WorkflowRuntime 클래스의 새 인스턴스를 초기화합니다.

public:
 WorkflowRuntime(System::String ^ configSectionName);
public WorkflowRuntime (string configSectionName);
new System.Workflow.Runtime.WorkflowRuntime : string -> System.Workflow.Runtime.WorkflowRuntime
Public Sub New (configSectionName As String)

매개 변수

configSectionName
String

애플리케이션 구성 파일에 있는 올바른 workflowSettings 섹션의 이름입니다.

예외

configSectionName이 null 참조(Visual Basic의 경우 Nothing)인 경우

애플리케이션 구성 파일에서 올바른 workflowSettings 섹션을 찾을 수 없는 경우

이 애플리케이션 도메인에 대한 WorkflowRuntime이 이미 있는 경우

설명

WorkflowRuntime은 애플리케이션 구성 파일의 configSectionName에 지정된 설정에 따라 초기화됩니다. configSectionName 유효한 같아야 workflowSettings 구성 파일의 섹션입니다.

워크플로 런타임 엔진은 애플리케이션 구성 파일을 사용 하 여 구성 되 면 로드 하 고에 나열 된 유형의 클래스를 인스턴스화하는 Services 구성 파일의 섹션입니다. 워크플로 런타임 엔진은 이러한 클래스를 생성할 때 다음 서명을 순서대로 사용하여 클래스 생성자를 찾습니다.

  1. Service(WorkflowRuntime 런타임, NameValueCollection 매개 변수)

  2. Service(WorkflowRuntime 런타임)

  3. Service(NameValueCollection 매개 변수)

  4. Service()

구성 파일에서 로드된 모든 서비스 클래스는 이러한 생성자 시그니처를 하나 이상 구현해야 합니다.

자세한 내용은 WorkflowRuntimeSection를 참조하세요.

적용 대상

WorkflowRuntime(WorkflowRuntimeSection)

지정된 WorkflowRuntime의 설정을 사용하여 WorkflowRuntimeSection 클래스의 새 인스턴스를 초기화합니다.

public:
 WorkflowRuntime(System::Workflow::Runtime::Configuration::WorkflowRuntimeSection ^ settings);
public WorkflowRuntime (System.Workflow.Runtime.Configuration.WorkflowRuntimeSection settings);
new System.Workflow.Runtime.WorkflowRuntime : System.Workflow.Runtime.Configuration.WorkflowRuntimeSection -> System.Workflow.Runtime.WorkflowRuntime
Public Sub New (settings As WorkflowRuntimeSection)

매개 변수

예외

settings이 null 참조(Visual Basic의 경우 Nothing)인 경우

이 애플리케이션 도메인에 대한 WorkflowRuntime이 이미 있는 경우

설명

이 생성자는 애플리케이션 구성 파일을 사용하지 않는 호스트에 대해 단일 메서드 호출을 사용하여 워크플로 런타임 엔진을 구성하는 메커니즘을 제공합니다. 애플리케이션 구성 파일을 사용하지 않는 데는 여러 가지 이유가 있을 수 있습니다. 예를 들어 호스트가 구성 파일의 사용을 허용하지 않는 환경에서 실행될 수 있습니다. 이러한 환경의 예로는 보안상의 이유로 애플리케이션 구성 파일 읽기를 허용하지 않는 신뢰할 수 있는 환경이 있습니다. 또한 호스트가 비공개 구성 메커니즘을 사용할 수 있습니다. 예를 들어 호스트가 워크플로 런타임 엔진 구성 설정을 SQL 데이터베이스에 저장할 수 있습니다.

워크플로 런타임 엔진은 WorkflowRuntimeSection.Services에 포함된 형식의 클래스를 로드하고 인스턴스화합니다. 워크플로 런타임 엔진은 이러한 클래스를 생성할 때 다음 서명을 순서대로 사용하여 클래스 생성자를 찾습니다.

  1. Service(WorkflowRuntime 런타임, NameValueCollection 매개 변수)

  2. Service(WorkflowRuntime 런타임)

  3. Service(NameValueCollection 매개 변수)

  4. Service()

settings에 지정된 모든 서비스 클래스는 이러한 생성자 시그니처를 하나 이상 구현해야 합니다.

적용 대상