Note: This post is part of a series and you can find the rest of the parts in the series index.
The TFS Integration Platform has two types of adapters, a WI (for work items, tasks, bugs etc…) and a VC (version control) adapter and they are nothing more than a .NET assembly made up of a number of classes which, mostly, you will inherit from interfaces in the Toolkit project. For both adapters the key interfaces you need to implement are:
- IProvider: Gives the platform the way to invoke your adapter.
- IMigrationProvider: This is used for writing to the adapters source system, so for me SharePoint.
- IMigrationItemSerializer: This provides support for converting the item to XML.
- IAnalysisProvider: This is used for reading from the adapters source system.
as well as they both need to implement the ChangeActionHandlers abstract class.
The VC adapter also needs:
- IServerPathTranslationService: Used to translate the path (i.e. directories and such) from other adapters to this adapter and visa versa.
While the WIT adapter needs:
- IConflictHandler: Provides support for handling conflicts during the migration.
So in both adapters you will need a minimum of 6 classes you will implement, excluding any extra ones you will need for your specific requirements.
The core concepts of the adapters are all explained in the interfaces and so it appears that it is very simple to implement, and indeed it is – however there are some weird things which may catch you up which we will cover in detail in future posts.
Something very nice in the platform is the TraceManager class which is really just a wrapper around System.Diagnostics.Trace but it has some extras in that wrapper, such as being what is included in the console windows and log files. You will see this sprinkled through out my code because it is useful to to have when trying to debug later on.
Power Tip: The TraceManager puts all information written to it in the log files, so please make sure you do not put any sensitive information in there.