While preparing for my next speaking engagement on WF, I came across an issue that cot me many many hours of time. I am not sure if it was because I took an unfortunate break from WF while training clients on ASP.Net 2.0, or if I still would have ran into the issue anyway. My problem was that my HandleExternalEvent Activity was not receiving the event when fired from my service. So I pulled up another example that I have used in many of my previous sessions and studied the differences of how I had wired it. I even thought that I had found a bug that I could report back since WF is beta, but the bug was mine! So instead of you having to deal with the same issue, I decided to share it and also list the requirements for using the activity.
- Must have an Interface to use as a contract with the HandleExternalEvent Activity
- ExternalDataExchange attribute must be set for the Interface...ex. [ExternalDataExchange]
- When using custom EventArgs, make sure that they inherit from ExternalDataEventArgs and that the object is Serializable... ex. [Serializable] public class RentalArgs : ExternalDataEventArgs
- HERE WAS MY PROBLEM...if one of your members returns another custom object, MAKE SURE THAT OBJECT IS SERIALIZABLE TOO...[Serializable]
- Your custom args object will have an instanceId base property from inheriting from ExternalDataEventArgs, that should be set by the InstanceId of the workflow that is running
- Finally, make sure the service you build to implements the interface.
Want to learn more about WF or you can't afford TechEd! Come to Tampa TechEd Outcasts, June 12-16