From Contract to Channel

When you create a client channel through ServiceModel, the shape of the channel is determined by various properties of your contract. Roughly the mapping is as follows:

OneWay Request/Reply Session Callback Channel
Any Any No Yes IDuplexChannel
Any Any No Yes IDuplexSesionChannel
Any Any Yes Yes IDuplexSessionChannel
Yes Yes No No IDuplexChannel
Yes Yes No No IRequestChannel
Yes Yes No No IDuplexSessionChannel
Yes Yes Yes No IDuplexSessionChannel
Yes Yes Yes No IRequestSessionChannel
Yes No No No IOutputChannel
Yes No No No IDuplexChannel
Yes No No No IDuplexSessionChannel
Yes No No No IRequestChannel
Yes No Yes No IOutputSessionChannel
Yes No Yes No IDuplexSessionChannel
Yes No Yes No IRequestSessionChannel
No Yes No No IRequestChannel
No Yes No No IDuplexChannel
No Yes No No IDuplexSessionChannel
No Yes Yes No IRequestSessionChannel
No Yes Yes No IDuplexSessionChannel

ServiceModel also has internal adapters so that, for example, if your stack supports IOutputSessionChannel, then ServiceModel can adapt that channel to a desired IOutputChannel. More on this in a later post.

2 Responses to “From Contract to Channel”

  1. Buddhike's Weblog Says:

    Kenny got the sixth sense ;-)

    Last night I was thinking about the way service model determines
    the channel shape for the communication….

  2. kennyw.com » Blog Archive » Adapting Channel Shapes Says:

    [...] As I implied in an earlier post, there’s a little more to the ServiceModel Channel Shapes then meets the eye. What I listed in the contract->shape mapping last week shows all the possibilities of what ServiceModel will request. However, it glosses over the process of how the channel requested is mapped to your service method. When you use ServiceModel, you get an extra layered channel at the top of your channel stack. The “Service Channel” has logic to normalize channel shapes into one-way and request reply patterns. [...]

Leave a Reply