次の方法で共有


Some strange behavior of the IPersistPropertyBag.Load method in the BizTalk adapter initialization

When developing the BizTalk adapter’s runtime component, it is required to implement IPersistPropertyBag interface and its Load method. Through the IPropertyBag parameter of the method, the messaging engine passes the adapter’s handler properties to the adapter when it initializes the adapter in runtime. And the administrators would configure the properties by BizTalk administration MMC before the adapter is executed.

For example,

public class Adapter : IPersistPropertyBag, …

{

        //…

public void Load(IPropertyBag pb, int pErrorLog)

{

  /*

   Through pb, this adapter will be given the handler properties which is configured through MMC.

 */

}

        //…

}

When developing the adapter’s design time component, the developer must implement IAdapterConfig’s GetConfigSchema method. And the method should return an XML schema which indicates what kind of information to be configured as the adapter’s handler properties.

And..ummm….the XML schema could include the default value for each property as following:
<xs:element name="pollingInterval" type="xs:int" default="1000" >

By the way, the problem is the messaging engine doesn’t pass the information to the adapter’s runtime until the user updates the values using the BizTalk administration tool. Only once the administrator configures them, it would work as described in the help file.
Even the File Adapter, the sample adapter in SDK, should miss this point, so it always throws an exception until the user configures it manually.
So, we have to implement some exception handling logic and keep the default value in the adapter’s code as well as the XML schema which IAdapterConfig’s GetConfigSchema returns.
I don’t know whether it is by intention or mistake. But, I hope this problem will be corrected soon.

Thanks