Search code examples
wcfwcf-binding

Following a WCF binding configuration naming convention


Is there a well-established naming convention in use for WCF binding configurations that someone could recommend? When examining the WCF/ WF samples from Microsoft, for example, there are multiple conventions used, including:

  • Binding + sequence number (e.g. "Binding1") is used most of the time
  • ProtocolName + Binding (e.g. "TcpBinding") is used for custom bindings
  • QueueName + Binding (e.g. OrderProcessorBinding) is used for msmq bindings
  • Binding description (e.g. "BindingWithSession") is used in some cases

Binding configuration names in projects I've worked on are similarly idiosyncratic. Should one desire greater consistency, is there an established convention one could follow?


Solution

  • A binding is a "recipe" for how the WCF channel stack will be assembled.

    In theory, every time you configure a binding configuration section in your wcf config (or in code) you are specifying some fairly exact behaviour that you require from the binding.

    So your binding name should really describe the "recipe" which you are using.

    As examples, if you are modifying send time-outs to support long running operations this should be reflected in your binding name. Similarly, if you are setting the binding security to transport-only for interoperability, then this could also be reflected.

    Bindings allow you to specify a wide range of behaviour, for example you may have a binding which is used with activex clients for which you may need to select an alternative formatter for serialisation. Naming this binding "Binding1" doesn't really explain what it's doing.

    So I think the binding should describe the recipe.