WorkflowRuntime::GetService<T> Method ()
Retrieves a service of the specified generic type from the workflow run-time engine.
Assembly: System.Workflow.Runtime (in System.Workflow.Runtime.dll)
| Exception | Condition |
|---|---|
| ObjectDisposedException | The WorkflowRuntime has already been disposed of. |
| InvalidOperationException | More than one service of the generic type was found. |
GetService<T> throws an InvalidOperationException if more than one service exists for the specified generic type. Therefore, you should use one of the overloaded methods of GetAllServices if it is possible that multiple services of the generic type are present in the WorkflowRuntime. For example, the workflow run-time engine may have multiple tracking services. If you request a tracking service by specifying the TrackingService base class, it is possible that an exception will be thrown.
The following example demonstrates how to retrieve a single service from a WorkflowRuntime object; in this case, a service of type ManualWorkflowSchedulerService. This example is from the Workflow Threading Sample.
Available since 3.0