| | | 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 | | namespace CoreWCF.Channels |
| | | 5 | | { |
| | | 6 | | public abstract class MessageEncodingBindingElement : BindingElement |
| | | 7 | | { |
| | 2108 | 8 | | protected MessageEncodingBindingElement() |
| | | 9 | | { |
| | 2108 | 10 | | } |
| | | 11 | | |
| | | 12 | | protected MessageEncodingBindingElement(MessageEncodingBindingElement elementToBeCloned) |
| | 10750 | 13 | | : base(elementToBeCloned) |
| | | 14 | | { |
| | 10750 | 15 | | } |
| | | 16 | | |
| | | 17 | | public abstract MessageVersion MessageVersion { get; set; } |
| | | 18 | | |
| | | 19 | | public abstract MessageEncoderFactory CreateMessageEncoderFactory(); |
| | | 20 | | |
| | | 21 | | public override T GetProperty<T>(BindingContext context) |
| | | 22 | | { |
| | 6701 | 23 | | if (context == null) |
| | | 24 | | { |
| | 0 | 25 | | throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull(nameof(context)); |
| | | 26 | | } |
| | 6701 | 27 | | if (typeof(T) == typeof(MessageVersion)) |
| | | 28 | | { |
| | 4567 | 29 | | return (T)(object)MessageVersion; |
| | | 30 | | } |
| | | 31 | | else |
| | | 32 | | { |
| | 2134 | 33 | | return context.GetInnerProperty<T>(); |
| | | 34 | | } |
| | | 35 | | } |
| | | 36 | | |
| | | 37 | | protected virtual bool CheckEncodingVersion(EnvelopeVersion version) |
| | | 38 | | { |
| | 0 | 39 | | return false; |
| | | 40 | | } |
| | | 41 | | |
| | | 42 | | protected override bool IsMatch(BindingElement b) |
| | | 43 | | { |
| | 0 | 44 | | if (!(b is MessageEncodingBindingElement encoding)) |
| | | 45 | | { |
| | 0 | 46 | | return false; |
| | | 47 | | } |
| | | 48 | | |
| | 0 | 49 | | return true; |
| | | 50 | | } |
| | | 51 | | } |
| | | 52 | | } |