| | | 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; |
| | | 5 | | using System.Collections.Generic; |
| | | 6 | | using CoreWCF.Channels; |
| | | 7 | | |
| | | 8 | | namespace CoreWCF.Description |
| | | 9 | | { |
| | | 10 | | internal class ConfigLoader |
| | | 11 | | { |
| | | 12 | | private readonly Dictionary<string, Binding> _bindingTable; |
| | | 13 | | private readonly IContractResolver _contractResolver; |
| | | 14 | | |
| | 0 | 15 | | public ConfigLoader(IContractResolver contractResolver) |
| | | 16 | | { |
| | 0 | 17 | | _contractResolver = contractResolver; |
| | 0 | 18 | | _bindingTable = new Dictionary<string, Binding>(); |
| | 0 | 19 | | } |
| | | 20 | | |
| | | 21 | | internal ContractDescription LookupContract(string contractName, string serviceName) |
| | | 22 | | { |
| | 0 | 23 | | ContractDescription contract = LookupContractForStandardEndpoint(contractName, serviceName); |
| | 0 | 24 | | if (contract == null) |
| | | 25 | | { |
| | 0 | 26 | | if (contractName == string.Empty) |
| | | 27 | | { |
| | 0 | 28 | | throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(SR.Format(SR |
| | | 29 | | } |
| | | 30 | | else |
| | | 31 | | { |
| | 0 | 32 | | throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(SR.Format(SR |
| | | 33 | | } |
| | | 34 | | } |
| | | 35 | | |
| | 0 | 36 | | return contract; |
| | | 37 | | } |
| | | 38 | | |
| | | 39 | | internal ContractDescription LookupContractForStandardEndpoint(string contractName, string serviceName) |
| | | 40 | | { |
| | 0 | 41 | | return _contractResolver.ResolveContract(contractName); |
| | | 42 | | } |
| | | 43 | | } |
| | | 44 | | } |