Overriding ChannelModel...

Topics: Technical Questions
Feb 17, 2009 at 12:50 PM
I'm trying to get my head around the ChannelModel that is shipped with MSE. The Security Guide Sample (Microsoft.MSE.Runtime.Channels.Security) shows an example of how this could be done. Some questions come to mind:

  1. Do I have to derive from ChannelModel or can I inherit from Binding (its base class)?
    I am trying to build a content-based router. I don't need the Address and Action properties, my mechanism will allow configuration of multiple Address and Action pairs. For an initial test I was planning on just configuring a couple of sets in the Xaml but ultimately I want to be able to call the BRE or the Workflow Rules Engine. So I want to derive from Binding to declare my own structure from there on.
  2. Who uses (consumes) the ChannelModel properties Address and Action?
    The aformentioned sample does not use them in its code. Are these mandatory MSE properties? The management console (or the catalog service) seems to know how to handle them; when using the wizard the channel and its moniker is configured correctly.

So I guess my main issue here is: can I get arround the ChannelModel and its properties?

Marc Jacobi


Feb 17, 2009 at 2:50 PM
You can inherit directly from Binding.  In doing so, you take complete control over the channel creation process including address and action if that is even relevant for the binding you would be creating.  The runtime engine will instantiate the binding described by your channel moniker Xaml and then call Binding.BuildChannelFactory().  At which point you would return the appropraite ChannelFactory that knows how to create Channels for use by the runtime to invoke the backend implementation.

When the ChannelMoniker does not describe a class that inherits from the known ChannelModel class, the runtime makes no assumptions about properties (i.e. Address, Action).  Deriving from ChannelModel is merely a shortcut since in this scenario the runtime will leverage the Action property in the Xaml and assign it to the Action request message header of the outgoing message.
Feb 18, 2009 at 6:31 AM

Great! Thank you.

I made a quick custom class derived from ChannelModel just to be able to set some break points and see what is going on at runtime. I changed the channel moniker root tags and added my namespace and it all worked. Later I realized that I did not change the Channel Moniker Schema (in Channel).

Can you elaborate on where the Channel Moniker Schema is used for exactly?

Feb 18, 2009 at 2:06 PM
It's not really used in this release.  But the intent is to have a schema that the channel moniker is validated against to help prevent simple mistakes when defining the Xaml.