Export (0) Print
Expand All

ModelElement.AddExtension Method (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.

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

public static ExtensionElement AddExtension(
	ModelElement element,
	ExtensionElement extension
)

Parameters

element
Type: Microsoft.VisualStudio.Modeling.ModelElement
ModelElement to be extended
extension
Type: Microsoft.VisualStudio.Modeling.ExtensionElement
The ExtensionElement to be added

Return Value

Type: Microsoft.VisualStudio.Modeling.ExtensionElement
The added extension

Although attempts to add a duplicate extension type are caught here, there are other cases where extensions may clash by contributing duplicate properties or roles, for example when two extensions are added that inherit from a common base that defines IMS properties and/or roles. Such cases are detected by IMergeElements implementation on ModelElement, but not by this low-level API

Community Additions

ADD
Show:
© 2014 Microsoft