WorkflowRuntimeService 類別

定義

警告

此 API 現已淘汰。

表示抽象基底類別,工作流程執行階段引擎核心服務由此衍生。Represents the abstract base class from which the workflow runtime engine core services are derived.

public ref class WorkflowRuntimeService abstract
[System.Obsolete("The System.Workflow.* types are deprecated.  Instead, please use the new types from System.Activities.*")]
public abstract class WorkflowRuntimeService
type WorkflowRuntimeService = class
Public MustInherit Class WorkflowRuntimeService
繼承
WorkflowRuntimeService
衍生
屬性

備註

注意

此資料討論已被汰換的類型及命名空間。This material discusses types and namespaces that are obsolete. 如需詳細資訊,請參閱 Windows Workflow Foundation 4.5 中即將淘汰的類型For more information, see Deprecated Types in Windows Workflow Foundation 4.5.

工作流程執行階段引擎可以啟動和停止衍生自 WorkflowRuntimeService 類別的服務。Services that derive from the WorkflowRuntimeService class can be started and stopped by the workflow runtime engine. 然而服務啟動或停止的順序是不確定的。服務可能需要其他服務的支援才可以在啟動時將自己本身正常初始化,相對的,服務也可能需要其他服務的支援才能在停止時正常關閉。The order in which the services are started or stopped, however, is indeterminate, and services may require the support of other services in order to properly initialize themselves when they are started, and, conversely, may require the to support of other services in order to properly shut down when they are stopped. 為了解決這個問題,工作流程執行階段引擎提供用於啟動和停止服務的兩階段機制。To address this problem, the workflow runtime engine provides two-phase mechanisms for starting and stopping services. 呼叫 StartRuntime 時,工作流程執行階段引擎會為每個衍生自 Start 類別的服務叫用 WorkflowRuntimeService 方法。When StartRuntime is called, the workflow runtime engine invokes the Start method for each of its services that derive from the WorkflowRuntimeService class. 啟動所有這些服務後,工作流程執行階段引擎會引發 WorkflowRuntime.Started 事件,從而為每個工作流程執行階段引擎服務叫用 OnStarted 方法。After all of these services have been started, the workflow runtime engine raises the WorkflowRuntime.Started event, which causes the OnStarted method to be invoked for each workflow runtime engine service. 您的服務可以覆寫 OnStarted 方法以參與這個兩階段的過程。Your service can override the OnStarted method to participate in this two phase process. 同樣地,當呼叫 StopRuntime 時,Stop 方法、WorkflowRuntime.Stopped 事件和 OnStopped 方法會提供這個兩階段機制。Similarly, when StopRuntime is called, the Stop method, the WorkflowRuntime.Stopped event, and the OnStopped method provide this two-phase mechanism. State 屬性包含 WorkflowRuntimeServiceState 值,該值表示服務正在啟動或停止中,或是已完全啟動或停止。The State property contains a WorkflowRuntimeServiceState value that indicates whether the service is in the process of starting or stopping or is completely started or stopped.

衍生自 WorkflowRuntimeService 類別的服務在遇到造成未處理例外狀況的情況時,可以透過呼叫 WorkflowRuntime.ServicesExceptionNotHandled 來引發 RaiseServicesExceptionNotHandledEvent 事件。Services that derive from the WorkflowRuntimeService class can raise the WorkflowRuntime.ServicesExceptionNotHandled event when they encounter a condition that causes an unhandled exception by calling RaiseServicesExceptionNotHandledEvent.

衍生自 WorkflowSchedulerService 類別、WorkflowCommitWorkBatchService 類別、WorkflowPersistenceService 類別和 TrackingService 類別的服務,最終都是衍生自 WorkflowRuntimeService 類別。Services derived from the WorkflowSchedulerService class, the WorkflowCommitWorkBatchService class, the WorkflowPersistenceService class, and the TrackingService class ultimately derives from the WorkflowRuntimeService class.

建構函式

WorkflowRuntimeService()

在衍生類別中實作時,初始化 WorkflowRuntimeService 類別的新執行個體。When implemented in a derived class, initializes a new instance of the WorkflowRuntimeService class.

屬性

Runtime

取得此服務的 WorkflowRuntimeGets the WorkflowRuntime for this service.

State

取得 WorkflowRuntimeService 的狀態。Gets the state of the WorkflowRuntimeService.

方法

Equals(Object)

判斷指定的物件是否等於目前的物件。Determines whether the specified object is equal to the current object.

(繼承來源 Object)
GetHashCode()

做為預設雜湊函式。Serves as the default hash function.

(繼承來源 Object)
GetType()

取得目前執行個體的 TypeGets the Type of the current instance.

(繼承來源 Object)
MemberwiseClone()

建立目前 Object 的淺層複本 (Shallow Copy)。Creates a shallow copy of the current Object.

(繼承來源 Object)
OnStarted()

在衍生類別中覆寫時,代表在工作流程執行階段引擎引發 Started 事件時將呼叫的方法。When overridden in a derived class, represents the method that will be called when the workflow runtime engine raises the Started event.

OnStopped()

在衍生類別中覆寫時,代表在工作流程執行階段引擎引發 Stopped 事件時將呼叫的方法。When overridden in a derived class, represents the method that will be called when the workflow runtime engine raises the Stopped event.

RaiseServicesExceptionNotHandledEvent(Exception, Guid)

引發 ServicesExceptionNotHandled 事件。Raises the ServicesExceptionNotHandled event.

Start()

在衍生類別中覆寫時,啟動服務並將 State 變更為 StartingWhen overridden in a derived class, starts the service and changes the State to Starting.

Stop()

在衍生類別中覆寫時,停止服務並將 State 變更為 StoppingWhen overridden in a derived class, stops the service and changes the State to Stopping.

ToString()

傳回代表目前物件的字串。Returns a string that represents the current object.

(繼承來源 Object)

適用於