Partager via


ElementWalker.ShouldVisitLinkAgain Method

True if the link has been visited before the currentElement (one of its roleplayers) was visited.

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

Syntax

'Déclaration
Protected Function ShouldVisitLinkAgain ( _
    link As ElementLink, _
    currentElement As ModelElement _
) As Boolean
protected bool ShouldVisitLinkAgain(
    ElementLink link,
    ModelElement currentElement
)
protected:
bool ShouldVisitLinkAgain(
    ElementLink^ link, 
    ModelElement^ currentElement
)
member ShouldVisitLinkAgain : 
        link:ElementLink * 
        currentElement:ModelElement -> bool 
protected function ShouldVisitLinkAgain(
    link : ElementLink, 
    currentElement : ModelElement
) : boolean

Parameters

Return Value

Type: System.Boolean

Remarks

When looking at the related elements of the given currentElement, if we find a link that has been enqueued for visiting, this function will tell you if it needs to be visited again. This is if the link has been visited before the currentElement (one of its roleplayers) was visited. For closure walkers, we guarantee that the link will be visited only after the roleplayers are visited (technically, we guarantee that the InternalElementList will contain the link after the roleplayers). Consider this scenario: We have element A that is a roleplayer for 2 relationships AHasBs and CHasAs. During the closure traversal, A is first approached from B through AHasBs. However, it does not have prop-delete on it, so it is not visited but the AHasBs is visited. Later in the traversal, A is approached from C via CHasAs. This time, A is visited because it has prop-delete. Now we get a case where AHasBs was visited before one of its roleplayers (A) was visited. To fix this, if the walkers find that a link has been visited (or rather, been enqueued for visiting) , it should check if it should be visited again (check if it was already visited before currentElement). If so, it should remove the link from the InternalElementList using the methods MarkForRemovalFromInternalElementList and RemoveMarkedElements, and add it to the queue to be visited again.

.NET Framework Security

See Also

Reference

ElementWalker Class

Microsoft.VisualStudio.Modeling Namespace