Table of Contents

Class Relation

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

Represents a relation between two dimensions.

public class Relation : RelationBase, IDynamicMetaObjectProvider, INotifyPropertyChanged, IDataErrorInfo, INullable
Inheritance
Object
Relation
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

Relation()

Initializes a new instance of the Relation class

public Relation()

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

Initializes a new instance of the Relation class.

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

Parameters

properties IEnumerable<KeyValuePair<Object, Object>>

Collection of properties.

Remarks

You can use this constructor to initialize a new instance of the ModelRelation class by specifying its properties in a list of key/value pairs. This is especially useful for dynamic languages like python.

Relation(Relation)

Initializes a new instance of the Relation class

public Relation(Relation element)

Parameters

element Relation

The relation to copy.

Remarks

This copy constructor creates copies of all value-typed properties. StorageColumns and Permissions from element are just added to the corresponding collections of the new Relation. No copying is performed.

Properties

BackReferenceInvariantFriendlyName

Gets or sets the name of the back reference invariant friendly.

public string BackReferenceInvariantFriendlyName { get; set; }

Property Value

String

The name of the back reference invariant friendly.

BackReferenceName

Gets or sets the name of the back reference for the relation.

public string BackReferenceName { get; set; }

Property Value

String

Remarks

In a 1:n relation the relation's name can be used to identify the related object on the left side of the relation (e.g. given a 1:n relationship CustomerRelation between customers and project its name can be used on a Project entity to identify the related Customer entity: Project.CustomerRelation).

The back reference name can be used to identify the list of entities on the right side of the relation (e.g. Customer.Projects can be used to identify all projects for a customer entity if Projects is the BackReferenceName of the relation).

You have to set the back reference name explicitly. If you do not set it you cannot use functions depending on back reference names (e.g. subqueries).

DefaultValueExpression

Gets or sets the expression that determines the default value of the property

public string DefaultValueExpression { get; set; }

Property Value

String

DefaultValueFunction

Gets the default value of a property by evaluate an expression

public Func<EntityObject, Environment, IEnumerable<QueryParameter>, object> DefaultValueFunction { get; }

Property Value

Func<EntityObject, Environment, IEnumerable<QueryParameter>, Object>

EvaluateDefaultValue

Gets a value indicating whether to evaluate the default value.

public bool EvaluateDefaultValue { get; }

Property Value

Boolean

true if the default value is to be evaluate; otherwise, false.

EvaluateDefaultValueExpression

Gets or sets the default value evaluation time expression.

public string EvaluateDefaultValueExpression { get; set; }

Property Value

String

The default value evaluation time expression.

EvaluateDefaultValueFunction

Gets a value determining whether a default value should be evaluated

public Func<EntityObject, bool> EvaluateDefaultValueFunction { get; }

Property Value

Func<EntityObject, Boolean>

HasDefaultValueExpression

Gets a value indicating whether a property has a default value expression or not

public bool HasDefaultValueExpression { get; }

Property Value

Boolean

IsNullable

Gets or sets a value indicating whether the Relation instance should be nullable or not.

public override bool IsNullable { get; set; }

Property Value

Boolean

true if this instance is nullable; otherwise, false.

OnDeleteAction

Gets or sets the on delete action.

public OnDeleteAction OnDeleteAction { get; set; }

Property Value

OnDeleteAction

StorageColumns

Gets a list of storage columns.

public virtual Collection<StorageColumn> StorageColumns { get; }

Property Value

Collection<StorageColumn>

List of storage columns.

Target

Gets or sets the target of the relation.

public override ModelEntityBase Target { get; set; }

Property Value

ModelEntityBase

Methods

Accept(ModelElementVisitor)

Accepts a visitor. Dispatches the correct call in the visitor.

public override void Accept(ModelElementVisitor visitor)

Parameters

visitor ModelElementVisitor

the visitor to accept.

InitializeObject()

Initializes the Relation object setting fields of the object to their default values.

protected override void InitializeObject()

IsValueAffectedByPropertyChange(EntityObject, String)

Determines whether the value for this property is changed if the memberName is changed.

public bool IsValueAffectedByPropertyChange(EntityObject entityObject, string memberName)

Parameters

entityObject EntityObject

The entityobject holding the property that changed.

memberName String

The name of the member (relation or property) that changed.

Returns

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

[OnDeserializing]
public void OnDeserializing(StreamingContext context)

Parameters

context StreamingContext

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 Relation.

public override RelationBase ShallowCopy()

Returns

RelationBase

A shallow copy of the current Relation.

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 Relation.

public override RelationBase ShallowCopy(string name, PersistBehavior persistBehavior, Ownership ownership, bool ignorePermissions = false, bool ignoreDefaultValues = false)

Parameters

name String

The name of the property to clone.

persistBehavior PersistBehavior

The PersistBehavior the cloned relation should have.

ownership Ownership

The Ownership the cloned relation should have.

ignorePermissions Boolean

if set to true [ignore permissions].

ignoreDefaultValues Boolean

if set to true [ignore default values].

Returns

RelationBase

A shallow copy of the current Relation.

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.

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 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.