Class TextProperty
- Namespace
- TimeCockpit.Data.DataModel
- Assembly
- TimeCockpit.Data.dll
Represents a property of type text in the Time Cockpit data model.
[DataType(typeof(string))]
[Column(typeof(string), SizePropertyName = "MaxStorageSize")]
[DefaultValue("")]
[FriendlyTypeName("Text")]
public class TextProperty : PersistedProperty, IDynamicMetaObjectProvider, INotifyPropertyChanged, IDataErrorInfo, INullable
- Inheritance
-
ObjectTextProperty
- Implements
-
IDynamicMetaObjectProviderINotifyPropertyChangedIDataErrorInfo
- Inherited Members
-
Object.ToString()Object.Equals(Object)Object.Equals(Object, Object)Object.ReferenceEquals(Object, Object)Object.GetHashCode()Object.GetType()Object.MemberwiseClone()
Constructors
TextProperty()
Initializes a new instance of the TextProperty class.
public TextProperty()
TextProperty(IEnumerable<KeyValuePair<Object, Object>>)
Initializes a new instance of the TextProperty class.
public TextProperty(IEnumerable<KeyValuePair<object, object>> properties)
Parameters
propertiesIEnumerable<KeyValuePair<Object, Object>>Collection of properties.
TextProperty(TextProperty)
Initializes a new instance of the TextProperty class.
public TextProperty(TextProperty element)
Parameters
elementTextPropertyThe 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
IsLocalized
Gets or sets a value indicating whether this instance is localized.
public bool IsLocalized { get; set; }
Property Value
- Boolean
trueif this instance is localized; otherwise,false.
MaxStorageSize
Gets or sets the maximum storage size of the text property.
[SchemaDatabaseMapping(SchemaDatabaseColumn.PropertyLengthPrecision)]
public int MaxStorageSize { get; set; }
Property Value
- Int32
Remarks
This property determines the maximum number of characters that can be stored in the text property. The value has to be between 1 and 4000 or System.Int32.MaxValue if the storage size should not be restricted (i.e. uses a data type like VARCHAR(MAX) in the database.
The default value is System.Int32.MaxValue.
Exceptions
- System.ArgumentException
Value is <=0 or >4000 and not System.Int32.MaxValue.
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 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 either a string value or null. Additionally verifies that the length of the string is less that MaxStorageSize.
public override bool ValidateValue(object value, out string errorMessage)
Parameters
valueObjectThe value to verify.
errorMessageStringThe resulting error message, or null if the value is valid.
Returns
- Boolean
Returns true if the
valueis valid for the property, false otherwise.