Class TypedConfiguredDeviceTypeResolver
A concrete device type resolver for configured device types with dynamic types specified via a Type configuration setting.
public class TypedConfiguredDeviceTypeResolver : ConfiguredDeviceTypeResolverBase, IConfiguredDeviceTypeResolver
- Inheritance
-
TypedConfiguredDeviceTypeResolver
- Implements
- Inherited Members
Remarks
See the remarks for ResolveType(Type, IConfigurationSection?, string?) for more details.
Constructors
TypedConfiguredDeviceTypeResolver()
Initializes a new instance of the TypedConfiguredDeviceTypeResolver class.
public TypedConfiguredDeviceTypeResolver()
Remarks
Default can be used to get a singleton instance created with this constructor.
TypedConfiguredDeviceTypeResolver(string)
Initializes a new instance of the TypedConfiguredDeviceTypeResolver class.
public TypedConfiguredDeviceTypeResolver(string typeNameSuffix)
Parameters
typeNameSuffixstringThe type name suffix to use when parsing a device type.
Exceptions
- ArgumentNullException
typeNameSuffixis null.
Properties
Default
Gets a default TypedConfiguredDeviceTypeResolver instance.
public static TypedConfiguredDeviceTypeResolver Default { get; }
Property Value
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 configuration section containing settings for this device, or null for device type registrations that do not use configuration settings.
typeValuestringThe Type setting value, or null if the setting does not exist.
Returns
- Type
The concrete type to use.
Remarks
The default implementation uses this logic:
- Attempt to resolve the type treating
typeValueas an assembly-qualified type name (see AssemblyQualifiedName), using GetType(string). - Attempt to resolve the type by searching all loaded assemblies for a type where
typeValueis the case-sensitive full type name (with namespace). - Attempt to resolve the type by searching all loaded assemblies for a type that derives from or implements
baseDeviceTypewheretypeValueis the case-sensitive type name (without namespace). - If a type name suffix was provided via the TypedConfiguredDeviceTypeResolver(string) constructor, attempt to resolve the type by
searching all loaded assemblies for a type that derives from or implements
baseDeviceTypewheretypeValueconcatenated with the type name suffix is the case-insensitive type name (without namespace).
Exceptions
- ArgumentNullException
baseDeviceTypeis null.- InvalidOperationException
The type could not be determined.