Class ModelProperty
Represents a property in the Time Cockpit data model.
Inheritance
Implements
Inherited Members
Namespace: TimeCockpit.Data.DataModel
Assembly: TimeCockpit.Data.dll
Syntax
public abstract class ModelProperty : ModelElement, IDynamicMetaObjectProvider, INotifyPropertyChanged, IDataErrorInfo, INullable
Constructors
ModelProperty()
Initializes a new instance of the ModelProperty class.
Declaration
protected ModelProperty()
ModelProperty(IEnumerable<KeyValuePair<Object, Object>>)
Initializes a new instance of the ModelProperty class.
Declaration
protected ModelProperty(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. |
ModelProperty(ModelProperty)
Initializes a new instance of the ModelProperty class.
Declaration
protected ModelProperty(ModelProperty element)
Parameters
Type | Name | Description |
---|---|---|
ModelProperty | element | The element to copy. |
Properties
ClrDefaultValue
Gets the default value for the .NET type of the property.
Declaration
public abstract object ClrDefaultValue { get; }
Property Value
Type | Description |
---|---|
System.Object |
DataType
Gets the .NET type of the property.
Declaration
public abstract Type DataType { get; }
Property Value
Type | Description |
---|---|
System.Type |
DefaultAggregateFunction
Gets or sets the default aggregate function.
Declaration
public DefaultAggregateFunction DefaultAggregateFunction { get; set; }
Property Value
Type | Description |
---|---|
DefaultAggregateFunction | The default aggregate function. |
DefaultValue
Gets the default value for a .NET.
Declaration
public object DefaultValue { get; }
Property Value
Type | Description |
---|---|
System.Object |
DefaultValueExpression
Gets or sets the expression that determines the default value of the property
Declaration
public string DefaultValueExpression { get; set; }
Property Value
Type | Description |
---|---|
System.String |
DefaultValueFunction
Gets the default value of a property by evaluate an expression
Declaration
public Func<EntityObject, Environment, IEnumerable<QueryParameter>, object> DefaultValueFunction { get; }
Property Value
Type | Description |
---|---|
System.Func<EntityObject, Environment, System.Collections.Generic.IEnumerable<QueryParameter>, System.Object> |
EvaluateDefaultValue
Gets a value indicating whether to evaluate the default value.
Declaration
public bool EvaluateDefaultValue { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
EvaluateDefaultValueExpression
Gets or sets the default value evaluation time expression.
Declaration
public string EvaluateDefaultValueExpression { get; set; }
Property Value
Type | Description |
---|---|
System.String | The default value evaluation time expression. |
EvaluateDefaultValueFunction
Gets a value determining whether a default value should be evaluated
Declaration
public Func<EntityObject, bool> EvaluateDefaultValueFunction { get; }
Property Value
Type | Description |
---|---|
System.Func<EntityObject, System.Boolean> |
HasDefaultValueExpression
Gets a value indicating whether a property has a default value expression or not
Declaration
public bool HasDefaultValueExpression { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
InvariantFriendlyTypeName
Gets the friendly type name of a model property
Declaration
public string InvariantFriendlyTypeName { get; }
Property Value
Type | Description |
---|---|
System.String |
IsDefaultDisplayProperty
Gets or sets a value indicating whether the ModelProperty is the default display property of a ModelEntity
Declaration
public bool IsDefaultDisplayProperty { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
IsNullable
Gets or sets a value indicating whether the ModelProperty instance should be nullable or not.
Declaration
public bool IsNullable { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Implements
Permissions
Gets the deny read write permissions of the ModelProperty.
Declaration
public ModelCollection<Permission> Permissions { get; }
Property Value
Type | Description |
---|---|
ModelCollection<Permission> |
Methods
Accept(ModelElementVisitor)
Accepts a visitor. Dispatches the visit handler for a ModelProperty. Note that more specific implementations of ModelProperty (e.g. TextProperty, NumericProperty, etc.) will use a different visitor (to be defined) approach, as this may need to be extensible.
Declaration
public override void Accept(ModelElementVisitor visitor)
Parameters
Type | Name | Description |
---|---|---|
ModelElementVisitor | visitor | the visitor to dispatch. |
Overrides
Attach(ModelElement)
Attaches a model element to a parent model element.
Declaration
protected override void Attach(ModelElement newParent)
Parameters
Type | Name | Description |
---|---|---|
ModelElement | newParent | Parent model element. |
Overrides
Remarks
Note to implementers: If your model element has sub-elements, your implementation of Attach
should call the base class' implementation and afterwards attach all sub-elements.
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException |
|
System.ArgumentException | Thrown in case of a recursion in the model element tree. |
Convert(Object)
Converts an object to the type of the property.
Declaration
public abstract object Convert(object value)
Parameters
Type | Name | Description |
---|---|---|
System.Object | value | Object to convert. |
Returns
Type | Description |
---|---|
System.Object | Returns the converted object. |
GetHumanReadableMemberPath()
Gets the human readable member path (includes parent entity name except for filter entities).
Declaration
protected string GetHumanReadableMemberPath()
Returns
Type | Description |
---|---|
System.String | Human readable member path. |
IsValueAffectedByPropertyChange(EntityObject, String)
Determines whether the value for this property is changed if the memberName
is changed.
Declaration
public bool IsValueAffectedByPropertyChange(EntityObject entityObject, string memberName)
Parameters
Type | Name | Description |
---|---|---|
EntityObject | entityObject | The entityobject holding the property that changed. |
System.String | memberName | The name of the member (relation or property) that changed. |
Returns
Type | Description |
---|---|
System.Boolean | Returns a value indicating whether the value of a property is affected by a changed property name. |
OnDeserializing(StreamingContext)
Called whenever deserialization of the model element is happening
Declaration
[OnDeserializing]
public void OnDeserializing(StreamingContext context)
Parameters
Type | Name | Description |
---|---|---|
System.Runtime.Serialization.StreamingContext | context | Stream context used for deserialization. |
Remarks
This method is necessary to instantiate an instance of the current ModelElement after deserialization. As for the System.Runtime.Serialization.DataContractSerializer, constructors are not always called and fields not correctly initialized. While deserializing, this method is called and the fields of the ModelElement are correctly initialized.
ShallowCopy()
Performs a shallow copy of the current ModelProperty.
Declaration
public ModelProperty ShallowCopy()
Returns
Type | Description |
---|---|
ModelProperty | A shallow copy of the current ModelProperty. |
Remarks
The MemberwiseClone method creates a shallow copy by creating a new object, and then copying the nonstatic fields of the current object to the new object. If a field is a value type, a bit-by-bit copy of the field is performed. If a field is a reference type, the reference is copied but the referred object is not; therefore, the original object and its clone refer to the same object.
ShallowCopy(String, PersistBehavior, Ownership, Boolean, Boolean)
Performs a shallow copy of the current ModelProperty.
Declaration
public ModelProperty ShallowCopy(string name, PersistBehavior persistBehavior, Ownership ownership, bool ignorePermissions = false, bool ignoreDefaultValues = false)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | The name of the property to clone. |
PersistBehavior | persistBehavior | The PersistBehavior the cloned property should have. |
Ownership | ownership | The Ownership the cloned property should have. |
System.Boolean | ignorePermissions | if set to |
System.Boolean | ignoreDefaultValues | if set to |
Returns
Type | Description |
---|---|
ModelProperty | A shallow copy of the current ModelProperty. |
Remarks
The MemberwiseClone method creates a shallow copy by creating a new object, and then copying the nonstatic fields of the current object to the new object. If a field is a value type, a bit-by-bit copy of the field is performed. If a field is a reference type, the reference is copied but the referred object is not; therefore, the original object and its clone refer to the same object.
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 wheter 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 modelelement, the Validate(ref IList<PropertyValidationMessage>, Boolean) method of all children attatched to the modelelemnt are validated recursivly.
ValidateValue(Object, out String)
Validates whether the value
is valid and provides an error message if not.
Declaration
public abstract bool ValidateValue(object value, out string errorMessage)
Parameters
Type | Name | Description |
---|---|---|
System.Object | value | The value to validate. |
System.String | errorMessage | The errorMessage, or null if it is valid. |
Returns
Type | Description |
---|---|
System.Boolean | Returns true if the value is valid, false otherwise. |