Yossi Dahan [BizTalk]

Google
 

Friday, January 12, 2007

Checking if a context property exists - the proper way

I wrote this two days ago, but as it appears, I was unaware of a crucially useful option.

Following through Richard Seroter's useful post I read through the list of the expression shape's allowed operations when I spotted exists

Using this operatoins one can use an expression such as "BTS.RetryCount exists Message_In" to check for the existence of a context property in the message.

Fantastic!

This does allow us to have that if instead of a try catch.
I still find it strange that there's an inconsistency between the behaviour in the orchestration and the XLNGMessage's GetPropertyValue, but I can't really complain now that I know there is a good solution.

Labels:

5 Comments:

  • This post has been removed by a blog administrator.

    By Anonymous jessica, at 14/01/2007 08:47  

  • This doesn't seem to work for Biztalk 2004 (unless I'm typing it wrong) - get the error "exists keyword can only be used in a receive predicate"

    By Blogger Ben Cops, at 05/02/2007 11:59  

  • Thanks Ben, I didn't check it on 2004 so it's good to know, if nothing but as an excuse for not knowing it until now.

    By Blogger Yossi Dahan, at 05/02/2007 17:33  

  • Ben is quite correct. The use of the exists keyword is much more restricted in BTS'04 than in BTS'06.

    I still need a relatively simple way ('cause I'm still a newbie at this stuff) to check for the existence of a context property in my BTS'04 orchestrations.

    By Blogger Howard, at 27/03/2007 18:19  

  • Howard - as wrote in the original post (linked from the beginning of this one) - you have two options I think- - either wrap your usage of the context proeprty in an exceptio handing scope or use a helper class to read the property.

    By Blogger Yossi Dahan, at 28/03/2007 08:59  

Post a Comment

<< Home