Reading a tagged value

ECO allows you to add TaggedValues (name/value pair) to your model at design time.  Here is how to retrieve the value of a TaggedValue at runtime.

obj.AsIObject() gives IObject
IObject.UmlType gives an IClassifier
IClassifier is an IModelElement, therefore....
IClassifier.TaggedValues['hello'] gives ITaggedValue
ITaggedValue.Value gives the string

ClassDisplayName :=
  obj.AsIObject().UmlType.TaggedValues['EcoExtensions.DisplayName'];

IProperty is also an IElement, so you can get tagged values for properties in exactly the same way.

obj.AsIObject().Properties['Name'].UmlType.......

 

Share this article!

Follow us!

Find more helpful articles: