DslDefinitionModelDeleteClosure.ShouldVisitRolePlayer Method
This method is called to ask the filter if a particular role player associated with an ElementLink should be Visited during traversal. This overrides the generated ShouldVisitRolePlayer() method, which examines the PropagateDelete attribute on the ElementLink to decide whether to visit the associated role players. In this case the RelationshipPort, the shape drawn as a little square where a relationship is connected to a class, was not deleted with the relationship. The reason is that the link used to connect the RelationshipPort (a shape) to the RoleConnector (also a shape) is a subtype of ElementLink called LinkConnectsToNode. Instances of this link type are used to associate various NodeShapes with LinkShapes and so do not propagate deletes, although in the case of the RelationshipPort it should. The same problem existed for InheritancePort, which like RelationshipPort extends TogglePort. This method is called for every ElementLink visited during a delete. If the link in question is an instance of LinkConnectsToNode and the roleplayer is a TogglePort, then the port shape may not be needed anymore. By checking how many links are left to the target role player this method returns VisitorFilterResult.YES if there is exactly one link to the port, VisitorFilterResult.DoNotCare otherwise. This ensures that when the last link to the node is deleted the port shape is deleted as well.
Namespace: Microsoft.VisualStudio.Modeling.DslDefinition
Assembly: Microsoft.VisualStudio.Modeling.Sdk.DslDefinition.12.0 (in Microsoft.VisualStudio.Modeling.Sdk.DslDefinition.12.0.dll)
Syntax
'Declaration
Public Overrides Function ShouldVisitRolePlayer ( _
walker As ElementWalker, _
sourceElement As ModelElement, _
elementLink As ElementLink, _
targetDomainRole As DomainRoleInfo, _
targetRolePlayer As ModelElement _
) As VisitorFilterResult
public override VisitorFilterResult ShouldVisitRolePlayer(
ElementWalker walker,
ModelElement sourceElement,
ElementLink elementLink,
DomainRoleInfo targetDomainRole,
ModelElement targetRolePlayer
)
public:
virtual VisitorFilterResult ShouldVisitRolePlayer(
ElementWalker^ walker,
ModelElement^ sourceElement,
ElementLink^ elementLink,
DomainRoleInfo^ targetDomainRole,
ModelElement^ targetRolePlayer
) override
abstract ShouldVisitRolePlayer :
walker:ElementWalker *
sourceElement:ModelElement *
elementLink:ElementLink *
targetDomainRole:DomainRoleInfo *
targetRolePlayer:ModelElement -> VisitorFilterResult
override ShouldVisitRolePlayer :
walker:ElementWalker *
sourceElement:ModelElement *
elementLink:ElementLink *
targetDomainRole:DomainRoleInfo *
targetRolePlayer:ModelElement -> VisitorFilterResult
public override function ShouldVisitRolePlayer(
walker : ElementWalker,
sourceElement : ModelElement,
elementLink : ElementLink,
targetDomainRole : DomainRoleInfo,
targetRolePlayer : ModelElement
) : VisitorFilterResult
Parameters
walker
Type: Microsoft.VisualStudio.Modeling.ElementWalkerElementWalker that is traversing the model
sourceElement
Type: Microsoft.VisualStudio.Modeling.ModelElementModel Element playing the source role
elementLink
Type: Microsoft.VisualStudio.Modeling.ElementLinkElement Link that forms the relationship to the role player in question
targetDomainRole
Type: Microsoft.VisualStudio.Modeling.DomainRoleInfoDomainRoleInfo of the target role
targetRolePlayer
Type: Microsoft.VisualStudio.Modeling.ModelElementModel Element that plays the target role in the relationship
Return Value
Type: Microsoft.VisualStudio.Modeling.VisitorFilterResult
Implements
.NET Framework Security
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.