Class ModelItem
Provides common metadata shared by elements and relationships in the model.
[DataContract]
public abstract class ModelItem
- Inheritance
-
ModelItem
- Derived
- Inherited Members
Properties
Id
The ID of this item in the model.
[DataMember(Name = "id", EmitDefaultValue = false)]
public string Id { get; }
Property Value
Perspectives
The set of perspectives associated with this element.
[DataMember(Name = "perspectives", EmitDefaultValue = false)]
public ISet<Perspective> Perspectives { get; }
Property Value
Properties
The collection of name-value property pairs associated with this element, as a Dictionary.
[DataMember(Name = "properties", EmitDefaultValue = false)]
public Dictionary<string, string> Properties { get; }
Property Value
Tags
The comma-separated tag list stored with this model item.
[DataMember(Name = "tags", EmitDefaultValue = false)]
public string Tags { get; set; }
Property Value
Methods
AddPerspective(string, string)
Adds a perspective to this model item.
public Perspective AddPerspective(string name, string description)
Parameters
namestringthe name of the perspective (e.g. "Security", must be unique)
descriptionstringThe narrative associated with the perspective.
Returns
- Perspective
The created Perspective.
Exceptions
- ArgumentException
Thrown when the name or description is blank, or when a perspective with the same name already exists.
AddProperty(string, string)
Adds a name-value pair property to this element.
public void AddProperty(string name, string value)
Parameters
Exceptions
- ArgumentException
Thrown when
nameorvalueis null, empty, or whitespace.
AddTags(params string[])
Adds one or more user-defined tags to this model item.
public void AddTags(params string[] tags)
Parameters
tagsstring[]The tags to add.
GetAllTags()
Returns the full tag list, including required built-in tags and user-specified tags.
public IEnumerable<string> GetAllTags()
Returns
- IEnumerable<string>
The complete set of tags as individual values.
GetRequiredTags()
Returns the built-in tags that must always be present for this model item.
public abstract List<string> GetRequiredTags()
Returns
GetTagsAsSet()
Returns the full tag list as a set without duplicates.
public ISet<string> GetTagsAsSet()
Returns
RemoveTag(string)
Removes a user-defined tag from this model item.
public virtual void RemoveTag(string tag)
Parameters
tagstringThe tag to remove.