| | | 1 | | // Licensed to the .NET Foundation under one or more agreements. |
| | | 2 | | // The .NET Foundation licenses this file to you under the MIT license. |
| | | 3 | | |
| | | 4 | | using CoreWCF.Configuration; |
| | | 5 | | using CoreWCF.Runtime; |
| | | 6 | | |
| | | 7 | | namespace CoreWCF.Channels |
| | | 8 | | { |
| | | 9 | | public abstract class BindingElement |
| | | 10 | | { |
| | 29454 | 11 | | protected BindingElement() { } |
| | | 12 | | #pragma warning disable RECS0154 // Parameter is never used |
| | 24914 | 13 | | protected BindingElement(BindingElement elementToBeCloned) { } |
| | | 14 | | #pragma warning restore RECS0154 // Parameter is never used |
| | | 15 | | |
| | | 16 | | public abstract BindingElement Clone(); |
| | | 17 | | |
| | | 18 | | public abstract T GetProperty<T>(BindingContext context) where T : class; |
| | | 19 | | |
| | | 20 | | internal T GetIndividualProperty<T>() where T : class |
| | | 21 | | { |
| | 1676 | 22 | | return GetProperty<T>(new BindingContext(new CustomBinding(), new BindingParameterCollection())); |
| | | 23 | | } |
| | | 24 | | |
| | | 25 | | |
| | | 26 | | //TODO: Move back to internal |
| | | 27 | | protected virtual bool IsMatch(BindingElement b) |
| | | 28 | | { |
| | | 29 | | Fx.Assert(true, "Should not be called unless this binding element is used in one of the standard bindings. I |
| | 0 | 30 | | return false; |
| | | 31 | | } |
| | | 32 | | |
| | | 33 | | public virtual IServiceDispatcher BuildServiceDispatcher<TChannel>(BindingContext context, IServiceDispatcher in |
| | | 34 | | { |
| | 488 | 35 | | if (context == null) |
| | | 36 | | { |
| | 0 | 37 | | throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull(nameof(context)); |
| | | 38 | | } |
| | | 39 | | |
| | 488 | 40 | | if (innerDispatcher == null) |
| | | 41 | | { |
| | 0 | 42 | | throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull(nameof(innerDispatcher)); |
| | | 43 | | } |
| | | 44 | | |
| | 488 | 45 | | return context.BuildNextServiceDispatcher<TChannel>(innerDispatcher); |
| | | 46 | | } |
| | | 47 | | |
| | | 48 | | public virtual bool CanBuildServiceDispatcher<TChannel>(BindingContext context) where TChannel : class, IChannel |
| | | 49 | | { |
| | 1920 | 50 | | if (context == null) |
| | | 51 | | { |
| | 0 | 52 | | throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull(nameof(context)); |
| | | 53 | | } |
| | | 54 | | |
| | 1920 | 55 | | return context.CanBuildNextServiceDispatcher<TChannel>(); |
| | | 56 | | } |
| | | 57 | | } |
| | | 58 | | } |