Class CollectionConfiguredDeviceEnumerator
A IConfiguredDeviceEnumerator for a collection of devices.
public class CollectionConfiguredDeviceEnumerator : ConfiguredDeviceEnumeratorBase, IConfiguredDeviceEnumerator
- Inheritance
-
CollectionConfiguredDeviceEnumerator
- Implements
- Inherited Members
Remarks
For this configured devices enumerator:
- The device type configuration section is assumed to contain a collection of sections, where each section contains the settings for each device.
- The Name setting in each device's configuration section will be used for the device 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
CollectionConfiguredDeviceEnumerator()
Initializes a new instance of the CollectionConfiguredDeviceEnumerator class that uses the registered device type as the concrete Type of the device (any setting named Type will be ignored).
public CollectionConfiguredDeviceEnumerator()
Remarks
Default can be used to get a singleton instance created with this constructor.
CollectionConfiguredDeviceEnumerator(IConfiguredDeviceTypeResolver)
Initializes a new instance of the CollectionConfiguredDeviceEnumerator class using a supplied IConfiguredDeviceTypeResolver.
public CollectionConfiguredDeviceEnumerator(IConfiguredDeviceTypeResolver typeResolver)
Parameters
typeResolver
IConfiguredDeviceTypeResolverThe IConfiguredDeviceTypeResolver to use.
Exceptions
- ArgumentNullException
typeResolver
is null.
CollectionConfiguredDeviceEnumerator(Type)
Initializes a new instance of the CollectionConfiguredDeviceEnumerator class that uses a specified concrete device Type (any setting named Type will be ignored).
public CollectionConfiguredDeviceEnumerator(Type concreteDeviceType)
Parameters
Exceptions
- ArgumentNullException
concreteDeviceType
is null.
Properties
Default
Gets a default CollectionConfiguredDeviceEnumerator instance.
public static CollectionConfiguredDeviceEnumerator Default { get; }
Property Value
Methods
EnumerateConfiguredDevices(Type, IConfigurationSection)
Enumerates configured devices.
public override IEnumerable<ConfiguredDeviceDefinition> EnumerateConfiguredDevices(Type baseDeviceType, IConfigurationSection configurationSection)
Parameters
baseDeviceType
TypeThe base Type for the registered device type.
configurationSection
IConfigurationSectionThe 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.