Class NumericProperty
Represents a property of type text in the Time Cockpit data model.
Inheritance
Implements
Inherited Members
Namespace: TimeCockpit.Data.DataModel
Assembly: TimeCockpit.Data.dll
Syntax
[DataType(typeof(decimal))]
[Column(typeof(decimal), PrecisionPropertyName = "Precision", ScalePropertyName = "Scale")]
[DefaultValue(0)]
[FriendlyTypeName("Numeric")]
public class NumericProperty : PersistedProperty, IDynamicMetaObjectProvider, INotifyPropertyChanged, IDataErrorInfo, INullable
Constructors
NumericProperty()
Initializes a new instance of the NumericProperty class.
Declaration
public NumericProperty()
NumericProperty(IEnumerable<KeyValuePair<Object, Object>>)
Initializes a new instance of the NumericProperty class.
Declaration
public NumericProperty(IEnumerable<KeyValuePair<object, object>> properties)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<System.Object, System.Object>> | properties | Collection of properties. |
NumericProperty(NumericProperty)
Initializes a new instance of the NumericProperty class.
Declaration
public NumericProperty(NumericProperty element)
Parameters
Type | Name | Description |
---|---|---|
NumericProperty | element | The element. |
Properties
ClrDefaultValue
Gets the default valud for the datatype for the property.
Declaration
public override object ClrDefaultValue { get; }
Property Value
Type | Description |
---|---|
System.Object |
Overrides
DataType
Gets the datatype for the property.
Declaration
public override Type DataType { get; }
Property Value
Type | Description |
---|---|
System.Type |
Overrides
FormatPattern
Gets or sets the pattern for displaying numbers.
Declaration
public string FormatPattern { get; set; }
Property Value
Type | Description |
---|---|
System.String |
Precision
Gets or sets the precision of the numeric underlying this property. Precision determines the number of available digits. see http://msdn.microsoft.com/en-us/library/ms190476.aspx.
Declaration
[SchemaDatabaseMapping(SchemaDatabaseColumn.PropertyLengthPrecision)]
public int Precision { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 |
Scale
Gets or sets the scale of the numeric underlying this property. Scale determines the number of digits right of the decimal point. see http://msdn.microsoft.com/en-us/library/ms190476.aspx
Declaration
[SchemaDatabaseMapping(SchemaDatabaseColumn.PropertyScale)]
public int Scale { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 |
Methods
Convert(Object)
Converts an object to the type of the property.
Declaration
public override object Convert(object value)
Parameters
Type | Name | Description |
---|---|---|
System.Object | value | Object to convert. |
Returns
Type | Description |
---|---|
System.Object | Returns the converted object. |
Overrides
Validate(ref IList<PropertyValidationMessage>, Boolean)
Validates a ModelElement according to certain rules.
Declaration
protected override void Validate(ref IList<PropertyValidationMessage> messages, bool validateRecursively)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IList<PropertyValidationMessage> | messages | An list of strings that stores that picks up the validation errors of a model element. |
System.Boolean | validateRecursively | Indicates whether to validate only the current model element or all its children (recursively) as well. |
Overrides
Remarks
The rules the ModelElement is validated against are dependent on the type of ModelElement that is validated. This method can be overridden to provide custom validation behavior for subclasses of ModelElement
When Validate(ref IList<PropertyValidationMessage>, Boolean) is called on a model element, the Validate(ref IList<PropertyValidationMessage>, Boolean) method of all children attached to the model element are validated recursively.
ValidateValue(Object, out String)
Validates that the value is of type decimal or null, if the property is null-able.
Declaration
public override bool ValidateValue(object value, out string errorMessage)
Parameters
Type | Name | Description |
---|---|---|
System.Object | value | The value to validate. |
System.String | errorMessage | The resulting error message, or null if there is none. |
Returns
Type | Description |
---|---|
System.Boolean | Returns true if the value is valid, false otherwise. |