Freigeben über


ModelElement.AddExtension Method

Definition

Overloads

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.

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.

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.

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.

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.

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:
 static Microsoft::VisualStudio::Modeling::ExtensionElement ^ AddExtension(Microsoft::VisualStudio::Modeling::ModelElement ^ element, Microsoft::VisualStudio::Modeling::DomainClassInfo ^ extensionClass);
public static Microsoft.VisualStudio.Modeling.ExtensionElement AddExtension (Microsoft.VisualStudio.Modeling.ModelElement element, Microsoft.VisualStudio.Modeling.DomainClassInfo extensionClass);
static member AddExtension : Microsoft.VisualStudio.Modeling.ModelElement * Microsoft.VisualStudio.Modeling.DomainClassInfo -> Microsoft.VisualStudio.Modeling.ExtensionElement
Public Shared Function AddExtension (element As ModelElement, extensionClass As DomainClassInfo) As ExtensionElement

Parameters

element
ModelElement

ModelElement to be extended

extensionClass
DomainClassInfo

The domain class of the type of ExtensionElement to be added

Returns

The newly instantiated and added extension

Applies to

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:
 static Microsoft::VisualStudio::Modeling::ExtensionElement ^ AddExtension(Microsoft::VisualStudio::Modeling::ModelElement ^ element, Microsoft::VisualStudio::Modeling::ExtensionElement ^ extension);
public static Microsoft.VisualStudio.Modeling.ExtensionElement AddExtension (Microsoft.VisualStudio.Modeling.ModelElement element, Microsoft.VisualStudio.Modeling.ExtensionElement extension);
static member AddExtension : Microsoft.VisualStudio.Modeling.ModelElement * Microsoft.VisualStudio.Modeling.ExtensionElement -> Microsoft.VisualStudio.Modeling.ExtensionElement
Public Shared Function AddExtension (element As ModelElement, extension As ExtensionElement) As ExtensionElement

Parameters

element
ModelElement

ModelElement to be extended

extension
ExtensionElement

The ExtensionElement to be added

Returns

The added extension

Remarks

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

Applies to

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:
 static Microsoft::VisualStudio::Modeling::ExtensionElement ^ AddExtension(Microsoft::VisualStudio::Modeling::ModelElement ^ element, Guid extensionClassId);
public static Microsoft.VisualStudio.Modeling.ExtensionElement AddExtension (Microsoft.VisualStudio.Modeling.ModelElement element, Guid extensionClassId);
static member AddExtension : Microsoft.VisualStudio.Modeling.ModelElement * Guid -> Microsoft.VisualStudio.Modeling.ExtensionElement
Public Shared Function AddExtension (element As ModelElement, extensionClassId As Guid) As ExtensionElement

Parameters

element
ModelElement

ModelElement to be extended

extensionClassId
Guid

The domain class id of the type of ExtensionElement to be added

Returns

The newly instantiated and added extension

Applies to

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:
 static Microsoft::VisualStudio::Modeling::ExtensionElement ^ AddExtension(Microsoft::VisualStudio::Modeling::ModelElement ^ element, Type ^ extensionType);
public static Microsoft.VisualStudio.Modeling.ExtensionElement AddExtension (Microsoft.VisualStudio.Modeling.ModelElement element, Type extensionType);
static member AddExtension : Microsoft.VisualStudio.Modeling.ModelElement * Type -> Microsoft.VisualStudio.Modeling.ExtensionElement
Public Shared Function AddExtension (element As ModelElement, extensionType As Type) As ExtensionElement

Parameters

element
ModelElement

ModelElement to be extended

extensionType
Type

The type of ExtensionElement to be added

Returns

The newly instantiated and added extension

Applies to

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.

public:
generic <typename T>
 where T : Microsoft::VisualStudio::Modeling::ExtensionElement static T AddExtension(Microsoft::VisualStudio::Modeling::ModelElement ^ element);
public static T AddExtension<T> (Microsoft.VisualStudio.Modeling.ModelElement element) where T : Microsoft.VisualStudio.Modeling.ExtensionElement;
static member AddExtension : Microsoft.VisualStudio.Modeling.ModelElement -> 'T (requires 'T :> Microsoft.VisualStudio.Modeling.ExtensionElement)
Public Shared Function AddExtension(Of T As ExtensionElement) (element As ModelElement) As T

Type Parameters

T

The type of ExtensionElement to be added

Parameters

element
ModelElement

ModelElement to be extended

Returns

T

The newly instantiated and added extension

Applies to