As promised, here's a sample managed adapter implementing a custom adapter configuration dialog for BizTalk Server 2006 R2. It isn't a fancy sample, just a new version of my /dev/null adapter with a simple, custom dialog. It should be enough, however, to illustrate the basic details needed to get you up and running quickly.

Here's a snapshot of the configuration dialog when invoked from the BizTalk Administration Console:

Adapter4

Some things I discovered that complement my previous article on the topic:

COM Registration: The class implementing IPropertyPageFrame needs to be registered with COM. However, you won't be able to use the "Register for COM interop" option in the Visual Studio project settings for this, because you'll get an error saying that the Microsoft.BizTalk.ExplorerOM.dll assembly isn't registered. To work around this, I created a custom build step that calls regasm.exe with the /registered option.

Property Bags: Remember I said you needed to implement two versions of IPersistPropertyBag? Turns out both are indeed needed. Even the BizTalk Administration Console will call both implementations at different times.

Also, it can become cumbersome to implement your adapter configuration load/save code for both IPropertyBag implementations, so I simply wrote a small adapter class that wraps the Microsoft.BizTalk.ExplorerOM.IPropertyBag instance so that it looks like a Microsoft.BizTalk.Admin.IPropertyBag one. This way I could write code just once to serialize/deserialize the adapter settings. You can find the wrapper class in PropBagAdapter.cs,

Registry: As usual, the adapter ships with a .REG file containing the adapter registry entries. Make sure to modify the file paths there so that they point to your project's location on disk. One thing worth noting here is how now the TransmitLocation_PageProv value contains the CLSID I explicitly gave to my TransmitLocPageProvider class (which implements IPropertyPageFrame).

Download: NullAdapterR2.zip.

I think you'll find the code is pretty straightforward and should give you an idea of how to get this up and running in your own adapters, if you're interested.


Tomas Restrepo

Software developer located in Colombia.