Class ConfiguredEmulatableDeviceTypeResolver
A concrete device type resolver for configured device types that uses a single concrete type, but that can optionally be emulated via a different concrete type if the Type setting value is "Emulated".
public class ConfiguredEmulatableDeviceTypeResolver : ConfiguredDeviceTypeResolverBase, IConfiguredDeviceTypeResolver
- Inheritance
-
ConfiguredEmulatableDeviceTypeResolver
- Implements
- Inherited Members
Constructors
ConfiguredEmulatableDeviceTypeResolver(Type, Type)
Initializes a new instance of the ConfiguredEmulatableDeviceTypeResolver class.
public ConfiguredEmulatableDeviceTypeResolver(Type deviceType, Type emulatedDeviceType)
Parameters
deviceTypeTypeThe normal device type, which will be used for devices with no Type setting value.
emulatedDeviceTypeTypeThe emulated device type, which will be used for devices with a Type setting of "Emulated".
Exceptions
- ArgumentNullException
deviceTypeis null.- ArgumentNullException
emulatedDeviceTypeis null.
Methods
ResolveType(Type, IConfigurationSection, string)
Determines the concrete type to use for a configured device.
public override Type ResolveType(Type baseDeviceType, IConfigurationSection configurationSection, string typeValue)
Parameters
baseDeviceTypeTypeThe base Type for the registered device type.
configurationSectionIConfigurationSectionThe optional configuration section containing settings for this device. This will be null for device type registrations that do not use configuration settings.
typeValuestringThe Type setting value. This will be null if the setting does not exist.
Returns
- Type
The concrete type to use.
Remarks
The default implementation throws an InvalidOperationException with a 'The Type setting "typeValue" is invalid' message,
so in overrides, if the type resolution fails, they can simply call the base class to cause an appropriate exception to be thrown.
Exceptions
- ArgumentNullException
baseDeviceTypeis null.- InvalidOperationException
The type could not be determined.