Edit

Share via


WorkflowRuntime.GetService Method

Definition

Overloads

GetService(Type)

Retrieves a service of the specified Type from the workflow run-time engine.

GetService<T>()

Retrieves a service of the specified generic type from the workflow run-time engine.

GetService(Type)

Retrieves a service of the specified Type from the workflow run-time engine.

public:
 virtual System::Object ^ GetService(Type ^ serviceType);
public object GetService(Type serviceType);
abstract member GetService : Type -> obj
override this.GetService : Type -> obj
Public Function GetService (serviceType As Type) As Object

Parameters

serviceType
Type

The Type of the service to retrieve.

Returns

The service of the specified Type.

Implements

Exceptions

serviceType is a null reference (Nothing in Visual Basic).

The WorkflowRuntime is already disposed of.

More than one service of type serviceType was found.

Remarks

GetService throws an InvalidOperationException if more than one service exists for the specified Type. Therefore, you should use one of the overloaded methods of GetAllServices if it is possible that multiple services of the specified 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.

Applies to

GetService<T>()

Retrieves a service of the specified generic type from the workflow run-time engine.

public:
generic <typename T>
 T GetService();
public T GetService<T>();
member this.GetService : unit -> 'T
Public Function GetService(Of T) () As T

Type Parameters

T

The service type.

Returns

T

A single service of the specified generic type.

Exceptions

The WorkflowRuntime has already been disposed of.

More than one service of the generic type was found.

Remarks

GetService 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.

Applies to