Table of Contents

Class NumericProperty

Namespace
TimeCockpit.Data.DataModel
Assembly
TimeCockpit.Data.dll

Represents a property of type text in the Time Cockpit data model.

[DataType(typeof(decimal))]
[Column(typeof(decimal), PrecisionPropertyName = "Precision", ScalePropertyName = "Scale")]
[DefaultValue(0)]
[FriendlyTypeName("Numeric")]
public class NumericProperty : PersistedProperty, IDynamicMetaObjectProvider, INotifyPropertyChanged, IDataErrorInfo, INullable
Inheritance
Object
NumericProperty
Implements
IDynamicMetaObjectProvider
INotifyPropertyChanged
IDataErrorInfo
Inherited Members
Object.ToString()
Object.Equals(Object)
Object.Equals(Object, Object)
Object.ReferenceEquals(Object, Object)
Object.GetHashCode()
Object.GetType()
Object.MemberwiseClone()

Constructors

NumericProperty()

Initializes a new instance of the NumericProperty class.

public NumericProperty()

NumericProperty(IEnumerable<KeyValuePair<Object, Object>>)

Initializes a new instance of the NumericProperty class.

public NumericProperty(IEnumerable<KeyValuePair<object, object>> properties)

Parameters

properties IEnumerable<KeyValuePair<Object, Object>>

Collection of properties.

NumericProperty(NumericProperty)

Initializes a new instance of the NumericProperty class.

public NumericProperty(NumericProperty element)

Parameters

element NumericProperty

The element.

Properties

ClrDefaultValue

Gets the default valud for the datatype for the property.

public override object ClrDefaultValue { get; }

Property Value

Object

DataType

Gets the datatype for the property.

public override Type DataType { get; }

Property Value

Type

FormatPattern

Gets or sets the pattern for displaying numbers.

public string FormatPattern { get; set; }

Property Value

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.

[SchemaDatabaseMapping(SchemaDatabaseColumn.PropertyLengthPrecision)]
public int Precision { get; set; }

Property Value

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

[SchemaDatabaseMapping(SchemaDatabaseColumn.PropertyScale)]
public int Scale { get; set; }

Property Value

Int32

Methods

Convert(Object)

Converts an object to the type of the property.

public override object Convert(object value)

Parameters

value Object

Object to convert.

Returns

Object

Returns the converted object.

Validate(ref IList<PropertyValidationMessage>, Boolean)

Validates a ModelElement according to certain rules.

protected override void Validate(ref IList<PropertyValidationMessage> messages, bool validateRecursively)

Parameters

messages IList<PropertyValidationMessage>

An list of strings that stores that picks up the validation errors of a model element.

validateRecursively Boolean

Indicates whether to validate only the current model element or all its children (recursively) as well.

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.

public override bool ValidateValue(object value, out string errorMessage)

Parameters

value Object

The value to validate.

errorMessage String

The resulting error message, or null if there is none.

Returns

Boolean

Returns true if the value is valid, false otherwise.