//------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ namespace System.ServiceModel.Channels { using System.Runtime; using System.ServiceModel; public abstract class BindingElement { protected BindingElement() { } protected BindingElement(BindingElement elementToBeCloned) { } public abstract BindingElement Clone(); public virtual IChannelFactory BuildChannelFactory(BindingContext context) { if (context == null) throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("context"); return context.BuildInnerChannelFactory(); } public virtual IChannelListener BuildChannelListener(BindingContext context) where TChannel : class, IChannel { if (context == null) throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("context"); return context.BuildInnerChannelListener(); } public virtual bool CanBuildChannelFactory(BindingContext context) { if (context == null) throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("context"); return context.CanBuildInnerChannelFactory(); } public virtual bool CanBuildChannelListener(BindingContext context) where TChannel : class, IChannel { if (context == null) throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("context"); return context.CanBuildInnerChannelListener(); } public abstract T GetProperty(BindingContext context) where T : class; internal T GetIndividualProperty() where T : class { return this.GetProperty(new BindingContext(new CustomBinding(), new BindingParameterCollection())); } internal virtual bool IsMatch(BindingElement b) { Fx.Assert(true, "Should not be called unless this binding element is used in one of the standard bindings. In which case, please re-implement the IsMatch() method."); return false; } } }