Table of Contents

Class IServiceProviderActivityExtensions

Namespace
Acuit.Pinpoint.Workflows.Testing
Assembly
Acuit.Pinpoint.Workflows.Testing.dll

Extension methods for IServiceProvider for use by activities.

public static class IServiceProviderActivityExtensions
Inheritance
IServiceProviderActivityExtensions
Inherited Members

Methods

GetRequiredDevice<TDevice>(IServiceProvider, string)

Gets a device from the IDeviceRegistry device registry service.

public static TDevice GetRequiredDevice<TDevice>(this IServiceProvider serviceProvider, string name = null) where TDevice : class

Parameters

serviceProvider IServiceProvider

The service provider.

name string

An optional device name.

Returns

TDevice

The device.

Type Parameters

TDevice

The device type.

Remarks

  1. If device type TDevice has never been registered or currently has no configured devices, InvalidOperationException will be thrown.
  2. If name is null or empty, then the first registered device of type TDevice will be returned.
  3. Otherwise, the first registered device of type TDevice with a name that matches name (case-sensitive) will be returned, or InvalidOperationException will be thrown if a match is not found.

Any configuration changes while the application is running that cause the device list for type TDevice to be regenerated will cause all active devices of that type to be disposed (if they implement IDisposable and recreated from the new configuration. While configuration changes typically only happen during application startup, clients should nonetheless hold on to and use the returned reference for only as long as is needed.

Exceptions

ArgumentNullException

serviceProvider is null.

InvalidOperationException

Required service of type IDeviceRegistry is not available.

InvalidOperationException

The registered device could not be found.