Search Wiki:


This sample demonstrates a basic implementation of a Team Foundation Server 2010 Warehouse Adapter.

This Adapter adds CSharp Assembly to File mappings into the Warehouse primarily for use with the out-of-box code churn metrics. It is not intended to be a production Adapter (there are several limitations to the approach) but instead demonstrates the general approach for those wishing to customize the TFS Warehouse.

Getting Started

Download and install (see below)
Build and run the sample (see below)


Visual Studio 2010
Team Foundation Server 2010


Unzip the sample to your machine

Building and Running the Sample

  • Open the .sln in Visual Studio 2010 (double click to open)
  • Resolve the Team Foundation Server assembly dependencies
  • CSharpAssemblyCodeChurnSample.Adapter Project
  • Micorosft.AnalysisServices - Location: GAC on computer with Microsoft SQL Server Analysis Services installed or download "Microsoft SQL Server 2005 Management Objects Collection" from - Location: <TFS 2010 Server install location>\Application Tier\TFSJobAgent\
  • Microsoft.TeamFoundation.Server - Location: <TFS 2010 Server install location>\Application Tier\TFSJobAgent\
  • Microsoft.TeamFoundation.VersionControl.Common - Location: GAC on TFS 2010 Server computer
  • Microsoft.TeamFoundation.VersionControl.Server - Location: <TFS 2010 Server install location>\Application Tier\TFSJobAgent\plugins\
  • Microsoft.TeamFoundation.Warehouse - Location: <TFS 2010 Server install location>\Application Tier\TFSJobAgent\plugins\
  • SetupCSharpCodeChurnAdapter Project
  • Microsoft.TeamFoundation.Client - Location: GAC on TFS 2010 Server computer
  • Build the Solution
  • Install and configure the custom Adapter
  • Follow the instructions in the ManageCustomWarehouseJob.cs file in the SetupCSharpCodeChurnAdapter Project.

File List

CSharpAssemblyCodeChurnSample.Adapter Project
  • AdapterConstants.cs - Some constants (i.e. table names) used throughout the adapter.
  • AnalysisDatabase.cs - Wrapper class for creating Analysis DB schema.
  • ChangesetProcessor.cs - Main class handling ETL for assembly and assembly mappings.
  • CSharpAssemblyCodeChurnSampleAdapter.cs - The main adapter. This is the object loaded by TFS and controls ETL and schema generation.
  • ServicingVersion.cs - Class to check schema version stamp in Warehouse and Analysis DB.
  • WarehouseDatabase.cs - Simple wrapper class on top of the Warehouse for creating schema and performing ETL.
  • WarehouseJobService.cs - Simple wrapper on the Job Service to queue the Warehouse Analysis Full Process job.
  • WarehouseTable.cs - Simple wrapper on a Warehouse table. See WarehouseDatabase.cs.
  • WarehouseTables.cs - Simple wrapper on a Warehouse table - strongly typed tables related to this adaper. See WarehouseDatabase.cs.
  • CreateCSharpAssemblyAddUpdateProcedure.sql - TQL to Add CSharp Assembly entries.
  • CreateCSharpAssemblyDestroyProcedure.sql - TSQL to Destroy CSharp Assembly entries.
  • CreateCSharpAssemblyTable.sql - TSQL to Create the CSharp Assembly table.
  • CreateCSharpAssemblyToFilesMappingAddUpdateProcedure.sql - TSQL to Add entries to the CSharp Assembly to File mapping.
  • CreateCSharpAssemblyToFilesMappingTable.sql - TSQL to Create the CSharp Assembly to File mapping table.
  • CreateCustomSqlMessages.sql - TSQL to add custom error messages to SQL.
  • SetupCSharpCodeChurnAdapter Project

  • ManageCustomWarehouseJob.cs - Simple console application to create and schedule the Adapter as a Warehouse job.
  • WarehouseJobManager.cs - Wrapper on top of the TFS Job Server to help create/schedule Warehouse jobs.

Other Files

Getting Started with a Custom Adapter.txt - Getting started with this adapter and do's and don'ts on writing your own adapter.
Last edited Apr 14 2010 at 2:14 PM  by JimLambTFS, version 2
Page view tracker