Table of Contents

Class OptionalSingleConfiguredDeviceEnumerator

Namespace
Acuit.Pinpoint.IO
Assembly
Acuit.Pinpoint.IO.Abstractions.dll

A IConfiguredDeviceEnumerator for an optional single device.

public class OptionalSingleConfiguredDeviceEnumerator : ConfiguredDeviceEnumeratorBase, IConfiguredDeviceEnumerator
Inheritance
OptionalSingleConfiguredDeviceEnumerator
Implements
Inherited Members

Remarks

For this configured devices enumerator:

  • The device type configuration section must be specified, but if it contains no settings, then no devices will be enumerated. If it contains any settings, then the settings are for a single device and a single device will be enumerated.
  • If the configuration section contains a setting named Name, then the single device will be given that name.
  • Concrete device types are resolved via an optionally supplied IConfiguredDeviceTypeResolver.
  • If the DeviceTypeRegistrationOptions used to register the device type does not have ConfigurationSection set, it will throw ArgumentNullException when enumerating devices.

Constructors

OptionalSingleConfiguredDeviceEnumerator()

Initializes a new instance of the OptionalSingleConfiguredDeviceEnumerator class that uses the registered device type as the concrete Type of the device (any setting named Type will be ignored).

public OptionalSingleConfiguredDeviceEnumerator()

Remarks

Default can be used to get a singleton instance created with this constructor.

OptionalSingleConfiguredDeviceEnumerator(IConfiguredDeviceTypeResolver)

Initializes a new instance of the OptionalSingleConfiguredDeviceEnumerator class using a supplied IConfiguredDeviceTypeResolver.

public OptionalSingleConfiguredDeviceEnumerator(IConfiguredDeviceTypeResolver typeResolver)

Parameters

typeResolver IConfiguredDeviceTypeResolver

The IConfiguredDeviceTypeResolver to use.

Exceptions

ArgumentNullException

typeResolver is null.

OptionalSingleConfiguredDeviceEnumerator(Type)

Initializes a new instance of the OptionalSingleConfiguredDeviceEnumerator class that uses a specified concrete device Type (any setting named Type will be ignored).

public OptionalSingleConfiguredDeviceEnumerator(Type concreteDeviceType)

Parameters

concreteDeviceType Type

The concrete device Type.

Exceptions

ArgumentNullException

concreteDeviceType is null.

Properties

Default

public static OptionalSingleConfiguredDeviceEnumerator Default { get; }

Property Value

OptionalSingleConfiguredDeviceEnumerator

Methods

EnumerateConfiguredDevices(Type, IConfigurationSection)

Enumerates configured devices.

public override IEnumerable<ConfiguredDeviceDefinition> EnumerateConfiguredDevices(Type baseDeviceType, IConfigurationSection configurationSection)

Parameters

baseDeviceType Type

The base Type for the registered device type.

configurationSection IConfigurationSection

The configuration section that contains the settings for the device type, which comes from ConfigurationSection in the device type registration options.

Returns

IEnumerable<ConfiguredDeviceDefinition>

An enumeration of ConfiguredDeviceDefinition objects representing the configured devices.

Exceptions

ArgumentNullException

configurationSection is null, but this implementation requires a configuration section to operate.