Pipeline components can expose their own custom properties at design time. Any public property defined in the component will be rendered in Pipeline Designer providing that read and write accessors for that property are implemented. Pipeline Designer will display the component properties in accordance with their declaration; for example, if the property is declared as read-only, it will be displayed as such in Pipeline Designer.
Custom pipeline components must implement the IPersistPropertyBag interface to enable the creation of these custom properties. Properties created with the IPersistPropertyBag interface can be set in the Properties window of Microsoft® Visual Studio® .NET, just like all the properties of the native pipeline components. This section contains procedures for configuring each of the included pipeline components.
The following code shows how to configure pipeline components.
[ComponentCategory(CategoryTypes.CATID_PipelineComponent)]
[ComponentCategory(CategoryTypes.CATID_Any)]
public class PipelineComponent :
IBaseComponent,
Microsoft.BizTalk.Component.Interop.IComponent,
Microsoft.BizTalk.Component.Interop.IPersistPropertyBag,
IComponentUI
{
private string prependData = null;
public string PrependData
{
get { return prependData; }
set { prependData = value;}
}
/// <summary>
/// IPersistPropertyBag.Load - Loads configuration property for component.
/// </summary>
/// <param name="pb">Configuration property bag.</param>
/// <param name="errlog">Error status (not used in this code).</param>
public void Load(Microsoft.BizTalk.Component.Interop.IPropertyBag pb, Int32 errlog)
{
val = (string)ReadPropertyBag(pb, "PrependData");
if (val != null) prependData = val;
}
/// <summary>
/// IPersistPropertyBag.Save - Saves the current component configuration into the property bag.
/// </summary>
/// <param name="pb">Configuration property bag.</param>
/// <param name="fClearDirty">Not used.</param>
/// <param name="fSaveAllProperties">Not used.</param>
public void Save(Microsoft.BizTalk.Component.Interop.IPropertyBag pb, Boolean fClearDirty, Boolean fSaveAllProperties)
{
val = (object)prependData;
WritePropertyBag(pb, "PrependData", val);
}
/// <summary>
/// Reads property value from property bag.
/// </summary>
/// <param name="pb">Property bag.</param>
/// <param name="propName">Name of property.</param>
/// <returns>Value of the property.</returns>
private static object ReadPropertyBag(Microsoft.BizTalk.Component.Interop.IPropertyBag pb, string propName)
{
object val = null;
try
{
pb.Read(propName,out val,0);
}
catch(ArgumentException)
{
return val;
}
catch(Exception ex)
{
throw new ApplicationException( ex.Message);
}
return val;
}
/// <summary>
/// Writes property values into a property bag.
/// </summary>
/// <param name="pb">Property bag.</param>
/// <param name="propName">Name of property.</param>
/// <param name="val">Value of property.</param>
private static void WritePropertyBag(Microsoft.BizTalk.Component.Interop.IPropertyBag pb, string propName, object val)
{
try
{
pb.Write(propName, ref val);
}
catch(Exception ex)
{
throw new ApplicationException( ex.Message);
}
}
This section contains:
To download updated BizTalk Server 2004 Help from www.microsoft.com, go to
http://go.microsoft.com/fwlink/?linkid=20616.
Copyright © 2004 Microsoft Corporation.
All rights reserved.