Martijn's blog - E-Commerce, EAI, BizTalk and .NET

2004/09/10

Property editors & pipeline components

There have been a lot of questions in the newsgroups recently regarding custom type editors within pipeline components.

I've created a sample component in which you choose which database you'd like to connect to and subsequently choose a customer the pipeline component is specific to. These kind of properties could be used to perform customer specific actions within a pipeline component.

Currently, the component implements a UITypeEditor derivement to implement it's editing functionality for choosing a customer. It uses the NorthWind database within the choosen server, and has very little error checking to see whether or not the DBMS exists, etc.

However, it demonstrates the purpose of custom editors for your properties, besides the obvious SchemaWithNone and SchemaList which are already supplied within Microsoft.BizTalk.Component.Utilities.dll and within my Pipeline Component Wizard.

Now for a screenshot, as it usually clarifies a lot (I've removed a portion of the connection string configured):



The component can be downloaded here

Please note this:

1) As BizTalk uses a component called ComponentObjectWrapper to wrap the actual object being handled within the pipeline component editor, and you simply cannot reference Microsoft.BizTalk.PipelineEditor.dll in a decent way without breaking Visual Studio integration with BizTalk, I've applied a "dirty" reflection hack in which I at runtime retrieve the actually instantiated component from this object using reflection, like this:

BindingFlags bindingFlags = BindingFlags.NonPublic | BindingFlags.Instance;
Type t = context.Instance.GetType();
FieldInfo fi = t.GetField("cachedPipelineComponent", bindingFlags);
CustomerSpecificComponent instance = fi.GetValue(context.Instance) as CustomerSpecificComponent;

 

It's a dirty way to get to the object, but it means I don't have to reference any other components and currently seems to be the only way to achieve reading another property from our design-time component.

2) The project has a build event specified which should deploy the component to the GAC. If it doesn't work, please alter it to represent the location of your gacutil installation.

As always, all sourcecode is included, and comments are very welcome!

16 Comments:

  • Cool.

    By Blogger Devdutt, at 4:20 PM  

  • For some reason when i try to add your component to the toolbox it wont add (It compiles fine).

    Then when i try to duplicate your code and use it inside my class the SQlConnection Editor works great, but the "Custom Editor" for the drop down does not work. The field is still treated as a string.

    Any Ideas?

    Scott
    sb_1@yahoo.com

    By Anonymous Anonymous, at 5:23 AM  

  • Did you run gacutil on it?

    By Blogger Martijn Hoogendoorn, at 10:56 AM  

  • I did run gacutil. The assembly installed, it was copied to the pipeline components directory, but when i try to add it to the toolkit i get the following error "You have selected a invalid pipeline component assembly. Please check the security on the assembly if you are loading it from a UNC path"

    Here is a Link to a few screen shots.

    By Anonymous Anonymous, at 4:11 AM  

  • Well i moved your files into a new project and now i can add it to the toolbox. i selected the connection string (northwind database in sqlserver), but when i go to select the customer, it is still treated as a string field instead of the dropdown appearing (as in your screenshot)

    Any help would be apprecaited.

    Thanks,

    Scott

    By Anonymous Anonymous, at 4:59 AM  

  • I looked into the issue and it turns out I was somewhat hasty and made a mistake with defining the namespace for the ResourceManager instance to use. Please change line 31 from using

    ("myComponentNamespace[...]")

    to using:

    ("Macaw.BizTalk.Samples.Customer[...]"

    and the component will appear in the toolbox.

    This error occurs because the VS.NET instance will try to retrieve descriptive information to show in the toolbox and will ignore the component if anything goes wrong in retrieving those properties (name, version, the likes)

    If the field is treated as a plain string value, the custom UITypeEditor instance is not getting fired. The normal reason for this would be if the component is not placed within the GAC.

    I'm awfully sorry for wasting your time by uploading a faulty example component. Please let me know if you run into any more troubles!

    I've uploaded a correct version for you to use.

    By Blogger Martijn Hoogendoorn, at 12:55 PM  

  • I got it working last night as well. Thanks for taking a look at it.

    Scott

    By Anonymous Anonymous, at 7:41 PM  

  • Have you read this article LINK
    on not putting pipeline components in the GAC. If i cant put a component in the GAC can I use custom property editors?

    Scott

    By Anonymous Anonymous, at 2:53 AM  

  • I knew the Metin2 gold so I always try my best to earn them more and more to make myself strong. I have never played the game before, at the beginning I did not know what is so I went to kill the monsters with the Metin2 yang that I earned with myself in the game. I will duty bound to a friend to help brush the Cheap metin2 yang together with my friends. I spend a good relationship is then fly to tears. If my levels are very high, I can go to Buy metin2 gold more and more and I will not depend on my friends to help me to earn them. I get some Cheap metin2 gold as the gifts to encourage me.

    By Anonymous Anonymous, at 1:23 AM  

  • Oes Tsetnoc one of the ways in which we can learn seo besides Mengembalikan Jati Diri Bangsa. By participating in the Oes Tsetnoc or Mengembalikan Jati Diri Bangsa we can improve our seo skills. To find more information about Oest Tsetnoc please visit my Oes Tsetnoc pages. And to find more information about Mengembalikan Jati Diri Bangsa please visit my Mengembalikan Jati Diri Bangsa pages. Thank you So much.
    Oes Tsetnoc | Semangat Mengembalikan Jati Diri Bangsa

    By Blogger Adi, at 9:14 AM  

  • Nice information, many thanks to the author. It is incomprehensible to me now, but in general, the usefulness and significance is overwhelming. Thanks again and good luck! Web Design Company

    By Anonymous Web Design Company, at 7:19 AM  

  • Interesting layout on your blog. I really enjoyed reading it and also I will be back to read more in the future.

    By Anonymous Gadgets UK, at 9:48 AM  

  • Thanks you. Very good post.Unless they can offer a really compelling reason for users to come back, it will be the next Bebo, MySpace
    10755GF

    By Anonymous 10755GF, at 11:20 PM  

  • Thanks you. Very good post.Unless they can offer a really compelling reason for users to come back, it will be the next Bebo, MySpace

    By Anonymous Cannon 10755GF, at 11:24 PM  

  • Stephen Stapinski

    Really your blog is very interesting.... it contains great and unique information. I enjoyed to visiting your blog. It's just amazing.... Thanks very much for the share.

    By Blogger rocky case, at 6:21 AM  

  • Visit this amazingly helpful website for real estates!!
    Real estate

    By Blogger maria, at 8:14 AM  

Post a Comment

Links to this post:

Create a Link

<< Home