Class ConfigurationProperty
- Namespace
- Loehnert.Lisrt.Modules.Configuration
- Assembly
- Loehnert.Lisrt.Modules.dll
Property information for a single property.
public class ConfigurationProperty
- Inheritance
-
ConfigurationProperty
- Inherited Members
- Extension Methods
Constructors
ConfigurationProperty(string, string)
Initializes a new instance of the ConfigurationProperty class.
public ConfigurationProperty(string value, string type)
Parameters
value
stringValue as string.
type
stringAssemblyQualifiedName of the type.
ConfigurationProperty(string, string, string, ConfigurationAttribute)
Initializes a new instance of the ConfigurationProperty class.
public ConfigurationProperty(string name, string value, string type, ConfigurationAttribute attribute = null)
Parameters
name
stringName for the property.
value
stringValue as string.
type
stringAssemblyQualifiedName of the type.
attribute
ConfigurationAttributeOptional configuration attribute with default value and description.
Exceptions
- ArgumentNullException
Thrown when
name
ortype
is null.- ArgumentException
Thrown when
attribute
s DefaultValue is not of typetype
.
Properties
DefaultValue
Gets the default value from the DefaultValue.
public object DefaultValue { get; }
Property Value
Description
Gets or sets the description from the Description.
public string Description { get; protected set; }
Property Value
IsValueType
Gets a value indicating whether the type of the property is a value. (e.g. string, bool, int ...)
public bool IsValueType { get; }
Property Value
Items
Gets the items when the property implements IList.
public ICollection<ConfigurationProperty> Items { get; }
Property Value
Name
Gets the property name.
public string Name { get; }
Property Value
Properties
Gets the inner properties.
public ICollection<ConfigurationProperty> Properties { get; }
Property Value
Type
Gets the AssemblyQualifiedName.
public string Type { get; }
Property Value
Unit
Gets the unit from the Unit.
public string Unit { get; }
Property Value
Value
Gets or sets Value as string.
public string Value { get; set; }
Property Value
Methods
ApplyDefaultValueToModule(ILisrtModule)
Apply the DefaultValue to the module.
public bool ApplyDefaultValueToModule(ILisrtModule module)
Parameters
module
ILisrtModuleTarget module with the property.
Returns
- bool
True if successful.
Remarks
If the default value type doesn't starts with the module type name and type assembly, it cannot be set. All exceptions will be caught and shown with ShowException(Exception, ILogger).
ApplyToModule(ILisrtModule, IStringConverter)
Apply the property information to the depending property of the ILisrtModule.
public bool ApplyToModule(ILisrtModule module, IStringConverter converter)
Parameters
module
ILisrtModuleTarget module with the property.
converter
IStringConverterConverter that converts a string value to the property value type.
Returns
- bool
True if successful.
Remarks
If the configuration type doesn't starts with the module type name and type assembly, it cannot be set. All exceptions will be caught and shown with ShowException(Exception, ILogger).
ToString()
Returns a string that represents the current object.
public override string ToString()
Returns
- string
A string that represents the current object.