Class DateTimeProperty
- Namespace
- TimeCockpit.Data.DataModel
- Assembly
- TimeCockpit.Data.dll
Represents a property of type date + time in the Time Cockpit data model.
[DataType(typeof(DateTime))]
[Column(typeof(DateTime), PrecisionPropertyName = "FractionalSecondsPrecision")]
[DefaultValue(typeof(DateTime))]
[FriendlyTypeName("DateTime")]
public class DateTimeProperty : DateProperty, IDynamicMetaObjectProvider, INotifyPropertyChanged, IDataErrorInfo, INullable
- Inheritance
-
ObjectDateTimeProperty
- Implements
-
IDynamicMetaObjectProviderINotifyPropertyChangedIDataErrorInfo
- Inherited Members
-
Object.ToString()Object.Equals(Object)Object.Equals(Object, Object)Object.ReferenceEquals(Object, Object)Object.GetHashCode()Object.GetType()Object.MemberwiseClone()
Constructors
DateTimeProperty()
Initializes a new instance of the DateTimeProperty class.
public DateTimeProperty()
DateTimeProperty(IEnumerable<KeyValuePair<Object, Object>>)
Initializes a new instance of the DateTimeProperty class.
public DateTimeProperty(IEnumerable<KeyValuePair<object, object>> properties)
Parameters
propertiesIEnumerable<KeyValuePair<Object, Object>>Collection of properties.
DateTimeProperty(DateTimeProperty)
Initializes a new instance of the DateTimeProperty class.
public DateTimeProperty(DateTimeProperty element)
Parameters
elementDateTimePropertyThe 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
FractionalSecondsPrecision
Gets or sets the fractional seconds precision for the date+time value.
[SchemaDatabaseMapping(SchemaDatabaseColumn.PropertyLengthPrecision)]
public int FractionalSecondsPrecision { get; set; }
Property Value
- Int32
Remarks
The default value is 0. The value must be between 0 and 7.
Exceptions
- System.ArgumentException
Value is <0 or >7.
ShowTime
Gets or sets a value indicating whether the time part should be shown.
public bool ShowTime { get; set; }
Property Value
- Boolean
Methods
Convert(Object)
Converts an object to the type of the property.
public override object Convert(object value)
Parameters
valueObjectObject 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
messagesIList<PropertyValidationMessage>An list of strings that stores that picks up the validation errors of a model element.
validateRecursivelyBooleanIndicates wheter 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 modelelement, the Validate(ref IList<PropertyValidationMessage>, Boolean) method of all children attatched to the modelelemnt are validated recursivly.
ValidateValue(Object, out String)
Validates that the value is of type DateTime or null, if the property is null-able.
public override bool ValidateValue(object value, out string errorMessage)
Parameters
valueObjectThe value to validate.
errorMessageStringThe resulting error message, or null if there is none.
Returns
- Boolean
Returns true if the value is valid, false otherwise.