| | | 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 System.Collections.Generic; |
| | | 5 | | using System.Xml; |
| | | 6 | | using CoreWCF.Channels; |
| | | 7 | | |
| | | 8 | | namespace CoreWCF.Description |
| | | 9 | | { |
| | | 10 | | public abstract class PolicyConversionContext |
| | | 11 | | { |
| | 41 | 12 | | protected PolicyConversionContext(ServiceEndpoint endpoint) |
| | | 13 | | { |
| | 41 | 14 | | if (endpoint == null) |
| | | 15 | | { |
| | 0 | 16 | | throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull(nameof(endpoint)); |
| | | 17 | | } |
| | | 18 | | |
| | 41 | 19 | | Contract = endpoint.Contract; |
| | 41 | 20 | | } |
| | | 21 | | |
| | | 22 | | public abstract BindingElementCollection BindingElements { get; } |
| | 0 | 23 | | public virtual BindingParameterCollection BindingParameters => null; |
| | 40 | 24 | | public ContractDescription Contract { get; } |
| | | 25 | | public abstract PolicyAssertionCollection GetBindingAssertions(); |
| | | 26 | | public abstract PolicyAssertionCollection GetOperationBindingAssertions(OperationDescription operation); |
| | | 27 | | public abstract PolicyAssertionCollection GetMessageBindingAssertions(MessageDescription message); |
| | | 28 | | public abstract PolicyAssertionCollection GetFaultBindingAssertions(FaultDescription fault); |
| | | 29 | | |
| | | 30 | | internal static XmlElement FindAssertion(ICollection<XmlElement> assertions, string localName, string namespaceU |
| | | 31 | | { |
| | 0 | 32 | | XmlElement result = null; |
| | 0 | 33 | | foreach (XmlElement assertion in assertions) |
| | | 34 | | { |
| | 0 | 35 | | if ((assertion.LocalName == localName) && |
| | 0 | 36 | | ((namespaceUri == null) || (assertion.NamespaceURI == namespaceUri))) |
| | | 37 | | { |
| | 0 | 38 | | result = assertion; |
| | 0 | 39 | | if (remove) |
| | | 40 | | { |
| | 0 | 41 | | assertions.Remove(result); |
| | | 42 | | } |
| | | 43 | | |
| | 0 | 44 | | break; |
| | | 45 | | } |
| | | 46 | | } |
| | | 47 | | |
| | 0 | 48 | | return result; |
| | | 49 | | } |
| | | 50 | | |
| | | 51 | | } |
| | | 52 | | } |