Editar

Compartilhar via


WorkflowRuntime.GetAllServices Method

Definition

Overloads

GetAllServices(Type)

Retrieves all the services that are added to the workflow run-time engine that implement or derive from the specified Type.

GetAllServices<T>()

Retrieves all the services that are added to the workflow run-time engine that implement or derive from the specified generic type.

GetAllServices(Type)

Retrieves all the services that are added to the workflow run-time engine that implement or derive from the specified Type.

public:
 System::Collections::ObjectModel::ReadOnlyCollection<System::Object ^> ^ GetAllServices(Type ^ serviceType);
public System.Collections.ObjectModel.ReadOnlyCollection<object> GetAllServices (Type serviceType);
member this.GetAllServices : Type -> System.Collections.ObjectModel.ReadOnlyCollection<obj>
Public Function GetAllServices (serviceType As Type) As ReadOnlyCollection(Of Object)

Parameters

serviceType
Type

The Type that services must implement to be returned.

Returns

Services that implement or derive from the specified Type.

Exceptions

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

Examples

The following example demonstrates how to retrieve all services of a given type from a WorkflowRuntime object.

// Create a new workflow runtime
WorkflowRuntime workflowRuntime = new WorkflowRuntime();
// Obtain the type of the TrackingService abstract class
Type serviceType = typeof(TrackingService);
// Create a services collection
ReadOnlyCollection<object> services;
// Fetch a collection of all services that match the given type
services = workflowRuntime.GetAllServices(serviceType);
' Create a new workflow runtime
Dim workflowRuntime As New WorkflowRuntime()
' Obtain the type of the TrackingService abstract class
Dim serviceType As Type = GetType(TrackingService)
' Create a services collection
Dim services As ReadOnlyCollection(Of Object)
' Fetch a collection of all services that match the given type
services = workflowRuntime.GetAllServices(serviceType)

Remarks

An empty ReadOnlyCollection<T> indicates that no services that implement or derive from the specified Type have been added to the workflow run-time engine.

Applies to

GetAllServices<T>()

Retrieves all the services that are added to the workflow run-time engine that implement or derive from the specified generic type.

public:
generic <typename T>
 System::Collections::ObjectModel::ReadOnlyCollection<T> ^ GetAllServices();
public System.Collections.ObjectModel.ReadOnlyCollection<T> GetAllServices<T> ();
member this.GetAllServices : unit -> System.Collections.ObjectModel.ReadOnlyCollection<'T>
Public Function GetAllServices(Of T) () As ReadOnlyCollection(Of T)

Type Parameters

T

The service type.

Returns

Services that implement or derive from the specified generic type.

Exceptions

Examples

The following example demonstrates how to retrieve all services of a given type from a WorkflowRuntime object.

// Create a new workflow runtime
WorkflowRuntime workflowRuntime = new WorkflowRuntime();
// Obtain the type of the TrackingService abstract class
Type serviceType = typeof(TrackingService);
// Create a services collection
ReadOnlyCollection<TrackingService> services;
// Fetch a collection of all services that match the given type
services = workflowRuntime.GetAllServices<TrackingService>();
' Create a new workflow runtime
Dim workflowRuntime As New WorkflowRuntime()
' Obtain the type of the TrackingService abstract class
Dim serviceType As Type = GetType(TrackingService)
' Create a services collection
Dim services As ReadOnlyCollection(Of TrackingService)
' Fetch a collection of all services that match the given type
services = workflowRuntime.GetAllServices(Of TrackingService)()

Remarks

An empty ReadOnlyCollection<T> indicates that no services have been added to the workflow run-time engine that implement or derive from the specified generic type.

Applies to