ModelElement Class

The base class for all domain model elements. All elements and links in a DomainModel are members of this type.

Inheritance Hierarchy

System.Object
  Microsoft.VisualStudio.Modeling.ModelElement
    Microsoft.VisualStudio.Modeling.Diagrams.PresentationElement
    Microsoft.VisualStudio.Modeling.DslDefinition.DomainElement
    Microsoft.VisualStudio.Modeling.DslDefinition.DslLibraryImport
    Microsoft.VisualStudio.Modeling.ElementLink
    Microsoft.VisualStudio.Modeling.ExtensionElement

Namespace:  Microsoft.VisualStudio.Modeling
Assembly:  Microsoft.VisualStudio.Modeling.Sdk.10.0 (in Microsoft.VisualStudio.Modeling.Sdk.10.0.dll)

Syntax

'Declaration
<DomainObjectIdAttribute("2b13e0d1-7959-458d-834f-2dc0769ce683")> _
Public MustInherit Class ModelElement _
    Implements IMergeElements
[DomainObjectIdAttribute("2b13e0d1-7959-458d-834f-2dc0769ce683")]
public abstract class ModelElement : IMergeElements
[DomainObjectIdAttribute(L"2b13e0d1-7959-458d-834f-2dc0769ce683")]
public ref class ModelElement abstract : IMergeElements
[<AbstractClass>]
[<DomainObjectIdAttribute("2b13e0d1-7959-458d-834f-2dc0769ce683")>]
type ModelElement =  
    class
        interface IMergeElements
    end
public abstract class ModelElement implements IMergeElements

The ModelElement type exposes the following members.

Constructors

  Name Description
Protected method ModelElement Initializes a new instance of the ModelElement class.

Top

Properties

  Name Description
Public property Id Gets the ID of the element.
Public property IsActive Gets the IsActive flag and verifies to see whether the element is active.
Public property IsDeleted Gets the IsDeleted flag and checks to see whether the element has been deleted from the model.
Public property IsDeleting Gets the IsDeleting flag and verifies whether the element is currently being deleted from the model.
Public property Partition Gets or sets the Partition that contains the element.
Public property Store Gets the Store that contains the element.

Top

Methods

  Name Description
Public methodStatic member AddExtension(ModelElement, DomainClassInfo) Extend the specified ModelElement with a newly instantiated extension of the specified domain type. An InvalidOperationException will be thrown if the element already has an extension of the same type.
Public methodStatic member AddExtension(ModelElement, ExtensionElement) Extend the specified ModelElement with a specified extension. An InvalidOperationException will be thrown if the element already has an extension of the same type.
Public methodStatic member AddExtension(ModelElement, Guid) Extend the specified ModelElement with a newly instantiated extension of the identified domain type. An InvalidOperationException will be thrown if the element already has an extension of the same type.
Public methodStatic member AddExtension(ModelElement, Type) Extend the specified ModelElement with a newly instantiated extension of the specified type. An InvalidOperationException will be thrown if the element already has an extension of the same type.
Public methodStatic member AddExtension<T>(ModelElement) Extend the specified ModelElement with a newly instantiated extension of a particular type. An InvalidOperationException will be thrown if the element already has an extension of the same type.
Protected method CanMerge Verifies whether a source element can be added to this element.
Protected method ChooseMergeTarget(ElementGroup) Selects a target element to accept as its child an element that the user wants to copy, drag, or create.
Protected method ChooseMergeTarget(ElementGroupPrototype) Selects a target element to accept as its child an element that the user wants to copy, drag, or create.
Public method Copy() Creates a copy of the element in the model.
Public method Copy(IEnumerable<Guid>) Creates a copy of the element and its child links and elements.
Public method Delete() Deletes an element from the model.
Public method Delete(array<Guid[]) Deletes an element from the model.
Public method Equals Determines whether the specified Object is equal to the current Object. (Inherited from Object.)
Protected method Finalize Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Public methodStatic member GetAllExtensions Return an enumerable that performs a breadth first traversal across the tree of extension elements embedded in the specified ModelElement.
Public methodStatic member GetBaseElement Returns the root of the virtual MEL in which the specified ModelElement is participating.
Public method GetDomainClass Gets the most-derived domain class for this element.
Public methodStatic member GetExtension(ModelElement, DomainClassInfo)
Public methodStatic member GetExtension(ModelElement, Guid)
Public methodStatic member GetExtension(ModelElement, Type) Get the ExtensionElement of the specified type from the available extensions of the specified ModelElement. If the element has no such extension then an InvalidOperationException will be raised.
Public methodStatic member GetExtension<T>(ModelElement) Get the ExtensionElement of the specified type from the available extensions of the specified ModelElement. If the element has no such extension then an InvalidOperationException will be raised.
Public method GetHashCode Serves as a hash function for a particular type. (Inherited from Object.)
Protected method GetRoleCollection<TCollection, TElement>(Guid) Gets or creates the linked element collection
Protected methodStatic member GetRoleCollection<TCollection, TElement>(ModelElement, Guid) Gets or creates the linked element collection
Public method GetType Gets the Type of the current instance. (Inherited from Object.)
Public methodStatic member IsExtendedBy(ModelElement, DomainClassInfo) Query whether the specified ModelElement is currently extended by an ExtensionElement of a particular type.
Public methodStatic member IsExtendedBy(ModelElement, Guid) Query whether the specified ModelElement is currently extended by an ExtensionElement of a particular type.
Public methodStatic member IsExtendedBy(ModelElement, Type) Query whether the specified ModelElement is currently extended by an ExtensionElement of a particular type.
Protected method MemberwiseClone Creates a shallow copy of the current Object. (Inherited from Object.)
Protected method MergeConfigure Allows the model element to configure itself immediately after the Merge process has related it to the target element.
Protected method MergeDisconnect Disconnects a source element from a target element.
Protected method MergeRelate Creates a relationship between this target element and the specified source element.
Protected method OnCopy Called when this element has been created as a copy of another element.
Protected method OnDeleted Called when this element has been deleted from the model.
Protected method OnDeleting Called when this element is about to be deleted.
Protected method OnResurrected Called when this element has been added back to a model.
Protected method OnRolePlayerPositionChanged Called when the position of a role has changed.
Protected method OnRolePlayerPositionChanging Called when a role player position is about to change.
Public methodStatic member RemoveExtension(ModelElement, DomainClassInfo) Remove any extension of the specified ModelElement that is of a particular domain type.
Public methodStatic member RemoveExtension(ModelElement, ExtensionElement) Remove a specified ExtensionElement from the extensions of the specified ModelElement.
Public methodStatic member RemoveExtension(ModelElement, Guid) Remove any extension of the specified ModelElement that is of a particular type.
Public methodStatic member RemoveExtension(ModelElement, Type) Remove any extension of the specified ModelElement that is of a particular type.
Public method ToString Returns a string that represents the current object. (Inherited from Object.)
Public methodStatic member TryGetExtension(ModelElement, DomainClassInfo)
Public methodStatic member TryGetExtension(ModelElement, Guid)
Public methodStatic member TryGetExtension(ModelElement, Type)
Public methodStatic member TryGetExtension<T>(ModelElement) Get the ExtensionElement of the specified type from the available extensions of the specified ModelElement. If the element has no such extension then the result will be null.

Top

Extension Methods

  Name Description
Public Extension Method AddExtension(Guid) Overloaded. Extend this ModelElement with newly instantiated extension of the identified domain type. An InvalidOperationException will be thrown if the element already has an extension of that type. (Defined by ModelElementExtensionMethods.)
Public Extension Method AddExtension(Type) Overloaded. Extend this ModelElement with a newly instantiated extension of the specified type. An InvalidOperationException will be thrown if the element already has an extension of that type. (Defined by ModelElementExtensionMethods.)
Public Extension Method AddExtension(DomainClassInfo) Overloaded. Extend this ModelElement with a newly instantiated extension of the specified domain type. An InvalidOperationException will be thrown if the element already has an extension of that type. (Defined by ModelElementExtensionMethods.)
Public Extension Method AddExtension(ExtensionElement) Overloaded. Extend this ModelElement with a specific extension. An InvalidOperationException will be thrown if the element already has an extension of the same type. (Defined by ModelElementExtensionMethods.)
Public Extension Method AddExtension<T>() Overloaded. Extend this ModelElement with a newly instantiated extension of a particular type. An InvalidOperationException will be thrown if the element already has an extension of the same type. (Defined by ModelElementExtensionMethods.)
Public Extension Method CanDelete Deletes the element from the model. (Defined by ImmutabilityExtensionMethods.)
Public Extension Method GetAllExtensions Return an enumerable that performs a breadth first traversal across the tree of extension elements embedded in this ModelElement. (Defined by ModelElementExtensionMethods.)
Public Extension Method GetBaseElement Returns the root of the virtual MEL in which the specified ModelElement is participating. (Defined by ModelElementExtensionMethods.)
Public Extension Method GetExtension(Guid) Overloaded. (Defined by ModelElementExtensionMethods.)
Public Extension Method GetExtension(Type) Overloaded. Get the ExtensionElement of the specified type from the available extensions of this ModelElement. If the element has no such extension then an InvalidOperationException will be raised. (Defined by ModelElementExtensionMethods.)
Public Extension Method GetExtension(DomainClassInfo) Overloaded. (Defined by ModelElementExtensionMethods.)
Public Extension Method GetExtension<T>() Overloaded. Get the ExtensionElement of the specified type from the available extensions of this ModelElement. If the element has no such extension then an InvalidOperationException will be raised. (Defined by ModelElementExtensionMethods.)
Public Extension Method GetLocks Get the lock flags for this element. This will include any locks enabled on the Partition containing the element. (Defined by ImmutabilityExtensionMethods.)
Public Extension Method IsExtendedBy(Guid) Overloaded. Query whether this ModelElement is currently extended by an ExtensionElement of a particular type. (Defined by ModelElementExtensionMethods.)
Public Extension Method IsExtendedBy(Type) Overloaded. Query whether this ModelElement is currently extended by an ExtensionElement of a particular type. (Defined by ModelElementExtensionMethods.)
Public Extension Method IsExtendedBy(DomainClassInfo) Overloaded. Query whether this ModelElement is currently extended by an ExtensionElement of a particular type. (Defined by ModelElementExtensionMethods.)
Public Extension Method IsLocked Test whether this element has any of a specified set of locks (Defined by ImmutabilityExtensionMethods.)
Public Extension Method RemoveExtension(Type) Overloaded. Remove any extension of this ModelElement that is of a particular type. (Defined by ModelElementExtensionMethods.)
Public Extension Method RemoveExtension(Guid) Overloaded. Remove any extension of the specified ModelElement that is of a particular type. (Defined by ModelElementExtensionMethods.)
Public Extension Method RemoveExtension(DomainClassInfo) Overloaded. Remove any extension of the specified ModelElement that is of a particular type. (Defined by ModelElementExtensionMethods.)
Public Extension Method RemoveExtension(ExtensionElement) Overloaded. Remove a specified ExtensionElement from the extensions of this ModelElement. (Defined by ModelElementExtensionMethods.)
Public Extension Method SetLocks Set the lock flags of this element (Defined by ImmutabilityExtensionMethods.)
Public Extension Method TryGetExtension(Guid) Overloaded. (Defined by ModelElementExtensionMethods.)
Public Extension Method TryGetExtension(Type) Overloaded. (Defined by ModelElementExtensionMethods.)
Public Extension Method TryGetExtension(DomainClassInfo) Overloaded. (Defined by ModelElementExtensionMethods.)
Public Extension Method TryGetExtension<T>() Overloaded. Get the ExtensionElement of the specified type from the available extensions of this ModelElement. If this element has no such extension then the result will be null. (Defined by ModelElementExtensionMethods.)

Top

Fields

  Name Description
Public fieldStatic member DomainClassId Represents the ID of the domain class for this element.

Top

Explicit Interface Implementations

  Name Description
Explicit interface implemetationPrivate method IMergeElements.CanMerge Returns true if this element can merge with the content of the prototype.
Explicit interface implemetationPrivate method IMergeElements.ChooseMergeTarget(ElementGroup)
Explicit interface implemetationPrivate method IMergeElements.ChooseMergeTarget(ElementGroupPrototype)
Explicit interface implemetationPrivate method IMergeElements.MergeConfigure
Explicit interface implemetationPrivate method IMergeElements.MergeDisconnect
Explicit interface implemetationPrivate method IMergeElements.MergeRelate

Top

Remarks

For more information, see Navigating and Updating a Model in Program Code.

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

See Also

Reference

Microsoft.VisualStudio.Modeling Namespace

Other Resources

Rules Propagate Changes Within the Model