Last time I mentioned there is something new in Platform Update 3 Beta called SendReceiveExtension. I still don’t know much about it other than the general reason for adding it to the .Net framework, which is basically to allow non-.Net classes to play the role of .Net’s WorkflowServiceHost class (System.ServiceModel.Activities).
Remember this stuff is all still in Beta. Unfortunately that also means there’s no documentation for it. Today I’m going to try to partially fix that deficiency, by thinking out loud, studying the new class and figuring out how it ticks.
Let’s start with a Reflector dump (which is where I often start with not-yet-documented features, which I meet regularly):
Basically every single method is abstract. There’s an instance of the ‘indirectedly overrideable’ pattern where instead of overriding RegisterReceive directly, we only get to override OnRegisterReceive. This may at first appear to be pointless indirection but notice it makes it possible for more logic to be added to the RegisterReceive base class by the .Net framework in the future (without giving you the option of overriding that logic).
Of the above classes, Bookmark and InstanceKey are established .Net framework citizens, dating back to release of WF4. If you’re a WF4 regular, you’ve probably heard about bookmarks before. What about InstanceKey?
MSDN says: “Represents an instance key and contains an identifier and metadata associated with the instance key. An instance key acts as a non-unique alias for an instance.”
My personal interpretation of that: “InstanceKeys are probably lightweight things that are used somewhere as lookup keys to find workflow instances. Sort of like cookies. With metadata.”
OK. What about SendSettings, ReceiveSettings, HostSettings? MSDN is absolutely no help at this specific point in time, so back to Reflector again.
What is that something else likely to be? Well, it’s likely to be either a Send or Receive activity, of course, and the way it grabs our SendReceiveExtension is thus: