locked
Is it possible to access ExecutionProperties in a code, or asyncode activity? RRS feed

  • Question

  • I notice that the contect in these doesn't have an executionProperties property.  I keep havind to convert activities across to native just for this feature.

    Is there a way to access this?


    Jason Bolstad
    Wednesday, October 27, 2010 7:56 PM

Answers

  • Not that I know of... you could consider implementing your own CodeActivity type to inherit from, to ease conversions.

    Tim

    • Marked as answer by Jason Bolstad Thursday, October 28, 2010 12:26 AM
    Wednesday, October 27, 2010 8:51 PM
  • If you look at the CodeActivityContext in MSDN, you might note that there is a method called GetProperty<THandle>.  But this method require the object you add to Properties in tha parent be derived from the Handle class, and this is a special type whose lifetime are handled by WF runtime (i.e. CorrelationHandle) and for your purpose, you should not arbitrarily derives object from this class just for retrieving Execution Properties.

    Therefore, Tim is right - you should be deriving from NativeActivity and access it via ExecutionProperties.Find(string).

    Hope it helps,

    Isaac

     

     

    • Marked as answer by Jason Bolstad Sunday, November 7, 2010 8:46 PM
    Thursday, October 28, 2010 5:23 AM

All replies

  • Not that I know of... you could consider implementing your own CodeActivity type to inherit from, to ease conversions.

    Tim

    • Marked as answer by Jason Bolstad Thursday, October 28, 2010 12:26 AM
    Wednesday, October 27, 2010 8:51 PM
  • I thought that might be the case.  Cheers Tim.
    Jason Bolstad
    Thursday, October 28, 2010 12:26 AM
  • If you look at the CodeActivityContext in MSDN, you might note that there is a method called GetProperty<THandle>.  But this method require the object you add to Properties in tha parent be derived from the Handle class, and this is a special type whose lifetime are handled by WF runtime (i.e. CorrelationHandle) and for your purpose, you should not arbitrarily derives object from this class just for retrieving Execution Properties.

    Therefore, Tim is right - you should be deriving from NativeActivity and access it via ExecutionProperties.Find(string).

    Hope it helps,

    Isaac

     

     

    • Marked as answer by Jason Bolstad Sunday, November 7, 2010 8:46 PM
    Thursday, October 28, 2010 5:23 AM