Artifact Consumer Obligations

An artifact consumer must be registered with the Team Foundation Server, and provide necessary functionality.

Artifact Registration

At registration time, each artifact consumer:

  • Must register each link type it hosts with Visual Studio 2005 Team Foundation Server.

  • Must register the URL of its consumer Web service interface.

  • Should subscribe to any events to which it can respond that include artifact change events.

Artifact Consumer API

Each artifact consumer:

  • Must offer GetReferencingArtifacts methods that can respond to referencing queries.

  • Should respond to ArtifactChanged events. For deletes, the referring artifact link should be deleted. For changes, the referring artifact can scan for a situation that could cause the link to be invalidated.

An artifact consumer must implement the ILinkingConsumer interface defined in the Microsoft.TeamFoundation.Server namespace on its registered Web service. This interface defines only one method.

Artifact[] GetReferencingArtifacts (string[] artifactUris)

The GetReferencingArtifacts takes an array of URIs as input. The return value is an array of all artifact objects that reference or link to one or more of the input artifact URIs.

Artifact Change Event Handler

As described here, every time an artifact materially changes, the artifact provider should raise a change event. Each artifact consumer should listen for these events by registering a matching event subscription.

The event handler for each consumer must examine the event to determine whether it holds artifacts of interest. If it does, the event handler for the consumer can then respond to the change. Generally, such a response takes one of the following forms:

  • For a delete, the consumer must remove any links to the deleted artifact.

  • For a change, the consumer in which there is a value for PreviousUri that differs from the value of URI, the consumer must replace all pointers it holds to PreviousUri with pointers to URI.

  • In some cases, there may be specific policy information that requires that the referenced artifact be in a specific state for the referring artifact to hold a link to it. Therefore, the consumer can make sure that after the change, the referenced artifact is still in the correct state. Otherwise, the consumer removes its links.

See Also

Concepts

Linking Service

Team Foundation Linking Basics

Artifact Provider Obligations

Linking Service Glossary