Bindings represent a wide variety of functionality. Everything from different transports, to different security mechanisms, delivery mechanisms, transactions, and custom protocols. Nonetheless, there are times where you want to make a decision based on a binding’s capabilities.
For example: “Does this binding support ordered delivery?”
Or: “Does this binding support both client and server authentication?”
WCF has a polymorphic way of making such inquiries of a Binding, though there are a few subtleties involved.
The first pivot point is to decide whether the capability is a property of the actual Binding, or a property exposed by the stack of Binding Elements. For example, supporting client authentication is a property of the underlying stack. It can be added at different layers (e.g. transport, WS-Security, etc), and can even be removed by some layers. These capabilities are accessed though a method on the Binding:
T GetProperty<T>()As in:
ISecurityCapabilities s = binding.GetProperty<ISecurityCapabilities>();GetProperty<T> simply constructs a Binding Context representing the stack of Binding Elements, and queries them through:
T GetProperty<T>(BindingContext context)Each individual Binding Element can handle the inquiry itself, delegate the inquiry, or a combination of the two. GetProperty is also supported by the runtime objects (IChannelFactory, IChannelListener, IChannel, etc).
Conversely, if a Binding claims to support Basic Profile 1.0, that is a claim about a particular coordination and configuration of binding elements. Therefore, this is not a feature to expose through T GetProperty<T>(). The Binding should instead implement the capability directly. For example:
public class MyBasicProfileBinding : IBasicProfile10BindingWhere IBasicProfile10Binding is an agreed upon interface. It is queried as “if (binding is IBasicProfile10Binding)”
Lastly, there are a handful of cases where a particular property is applicable to all bindings. In that case, we use the traditional approach of a strongly typed property on our base class. For example:
public abstract string Scheme { get; }
To re-cap: for polymorphic properties, use GetProperty<T>. For capabilities of the binding element stack, and interface implementation for composite capabilities provided by the concrete binding.



The last time I was at Ray’s was in 1998, and I had memories of a gorgeous view of the Olympic mountains and great seafood dining. Things have changed. The restaurant is now on the shore just south of Golden Gardens (even more of a schlep than Ballard), upped their prices, and (with the notable exception of their salmon chowder) the food was forgettable.
Second course: I was excited about the halibut, as the Alaskan season has just started and the description was mouth-watering. Unfortunately the only tasty pieces of this nice-looking plate were the juicy fresh tomatoes. The halibut was flavorless, and overcooked. Halibut at its finest is light and flaky and I savor that texture. Perhaps my expectations were too high, but at a menu price of $25.95 in a restaurant supposedly “best of breed” for local seafood I must say it was a disappointment. Mike’s salmon was respectable, and the pesto sauce complemented the natural grilled flavors nicely.
For the past few Tuesdays
We also were able to witness the two sizes of burritos. The “regular” is what is pictured here. Split three ways we barely managed to finish it off. The “grande” is about 1.6 times the size (only $1 more!) and can supply most people with 3-4 solid meals. We ordered a “regular wet chicken burrito fajita-style” from the friendly cashier. Fajita-style means that in addition to the black beans, salsa, rice, sour cream, and chicken they add grilled onions and bell peppers.