Export (0) Print
Expand All

WorkflowRuntimeService.OnStopped Method

When overridden in a derived class, represents the method that will be called when the workflow runtime engine raises the WorkflowRuntime.Stopped event.

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

protected virtual void OnStopped()

The WorkflowRuntimeService class implements a two-phase stopping mechanism so that workflow runtime engine services may retain some functionality after their Stop method is invoked by the workflow runtime engine in order that they may, if necessary, support the shutdown of other services. After the workflow runtime engine has called the Stop method of all of its workflow runtime engine services, it raises the WorkflowRuntime.Stopped event. You can override the OnStopped method to provide any final shutdown functionality required by your service when the WorkflowRuntime.Stopped event is raised. The mechanics of subscribing and unsubscribing from the WorkflowRuntime.Stopped event is handled internally.

NoteNote

If your WorkflowRuntimeService is removed from the workflow runtime engine by a call to RemoveService while the workflow runtime engine is running, the workflow runtime engine will call Stop on your service. However, in this situation, the OnStopped method will not be called for your service. Therefore, your service may have to perform any final shutdown that it would ordinarily perform in OnStopped from inside the Stop method. You can test IsStarted to determine whether the workflow runtime engine is running.

State is set to Stopped before OnStopped is invoked. The default implementation of OnStopped performs no action.

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0
Show:
© 2015 Microsoft