Accessing Registration Data

The registration service enables Team Foundation clients and tools to get tool metadata from the registration database. The registration service is designed for access from a wide variety of clients, through a Web service. Alternatively, clients using managed code can access the service through proxies on the server.

Obtaining Registration Data from Managed Code

Team Foundation clients and tool servers get registration data for a service through an IRegistration interface, obtained by using the GetProxy method. The GetProxy method specifies the type of service, and the domain name, if it is needed.

There are three basic steps, described in the following section, to obtain information about services:

  1. Get the domain on which the service exists.

  2. Get a proxy for the service.

  3. Get registration entries for the service.

Getting the Domain

The first step, getting the domain, is different for clients and servers.

A client can get currently available Team Foundation domains from values in the Windows registry. The registry contains domain names, and for each domain the network address of its single Team Foundation Server.

With a tool server, the domain is retrieved from the Windows registry. Because each tool server belongs to a single domain, the domain is known implicitly.

Getting the Proxy

The next step is to get a proxy for the service. You do this using the GetProxy method. This method takes the service type as a parameter. The domain is a required parameter on the client, and optional on a tool server.

All the proxies are cached, so that there is no need for the caller to cache them.

Getting Registration Entries

When the caller has a Registration proxy, it can call the GetRegistrationEntries method provided by the proxy. GetRegistrationEntries has one parameter, specifying the tool type for which entries are returned. If no tool type is specified, the method returns a list of all the registration entries for the domain.

The GetRegistrationEntries method, given a tool identifier, this method returns a list of registration entries with this identifier. For an empty string input, the method returns a list of all the registration entries. Given a tool name (that is <tool type>) the method returns the registration entry for that tool.

Example

The following example shows how to obtain registration entries for a server. In this example, m_package is a Team Foundation package object.

using Microsoft.VisualStudio.TeamFoundation.Services;

{

IBisClientServices serviceProvider =

(IBisClientServices)m_package.GetService(typeof(IBisClientServices));

string domain = "DomainCallerIsInterestedIn";

if (serviceProvider != null)

{

IRegistration regProxy = (IRegistration)serviceProvider.GetProxy(domain, typeof(IRegistration));

}

RegistrationEntry[] regEntries = regProxy.GetRegistrationEntries("Curritemp");

}

Web Service Access

For tools that cannot use the Team Foundation proxies, the GetRegistrationEntries method is also provided in the Registration Web Service from the Team Foundation Server. You do this using the Registration.asmx page.

An example for such a case occurs when you call the Team Foundation Server from unmanaged code.

Adding Registration Data

During installation, the registration data must be put into the Team Foundation database. You do this through a utility named TFSReg.exe that takes as input an XML file representing the registration data. The entries can be added either separately or all together. The utility also supports delete and update operations. Sample XML that can be used by this utility is given in the Appendix. TFSReg also takes the Team Foundation database server name, Team Foundation database name as input. Default behavior is adding the entries. "/D" flag deletes the entries in the configuration file.

See Also

Concepts

Registration Service

Working with Registration Entries