Failed to retreive [sic] the basic properties of the Pipeline component: 'xxx'
I wanted to provide a character encoding property on a pipeline component, so that the developer using the component could select the appropriate encoding that the incoming and outgoing stream should use. Having seen a similar property in the flat file assembler, I cracked open reflector and pointed it at ffasm.dll. The TargetCharset property is typed for a class called "CharsetList", which is basically just a class that takes a codepage and the name of the charset and is marked with the following attributes
Also defined is the class CharsetPropertyEditor : UITypeEditor. This has a DrawItem method that produces the nice dropdown list of available character sets. In the same assembly there appears to be a similar affair for the schema selection list you've seen a million times, so I'll be stealing that when the need arises.
So, I created the property, typed it for CharsetList (which lives in Microsoft.BizTalk.Component.Utilities), added code to persist the field in the propertybag, deployed the pipeline component, but everytime I used it in a pipeline, and tried to save the pipeline, vstudio pipes up with the above error.
After a bit of digging, the answer was obvious. CharsetList doesn't implement IPersistPropertyBag - I'm so used to expecting everything to work for me when I see [Serializable] that I forgot about the plumbing of this old ActiveX interface. The code to persist the charsetlist now looks like:
So I just sidestepped the issue and persisted the two fields in the object seperately. You could also inherit from charsetlist and implement IPersistPropertybag.
[Serializable, Editor(typeof(CharsetPropertyEditor), typeof(UITypeEditor))]
public class CharsetList
Also defined is the class CharsetPropertyEditor : UITypeEditor. This has a DrawItem method that produces the nice dropdown list of available character sets. In the same assembly there appears to be a similar affair for the schema selection list you've seen a million times, so I'll be stealing that when the need arises.
So, I created the property, typed it for CharsetList (which lives in Microsoft.BizTalk.Component.Utilities), added code to persist the field in the propertybag, deployed the pipeline component, but everytime I used it in a pipeline, and tried to save the pipeline, vstudio pipes up with the above error.
After a bit of digging, the answer was obvious. CharsetList doesn't implement IPersistPropertyBag - I'm so used to expecting everything to work for me when I see [Serializable] that I forgot about the plumbing of this old ActiveX interface. The code to persist the charsetlist now looks like:
Object charSetName = ReadPropertyBag(pb, "charSetName");
Object charSetCodePage = ReadPropertyBag(pb, "charSetCodePage");
if (charSetName != null && charSetCodePage != null && (int)charSetCodePage != 0) CharSet = new CharsetList((string)charSetName, (int)charSetCodePage);
So I just sidestepped the issue and persisted the two fields in the object seperately. You could also inherit from charsetlist and implement IPersistPropertybag.
0 Comments:
Post a Comment
<< Home