| | | 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 System.Runtime.Serialization; |
| | | 7 | | using CoreWCF.Description; |
| | | 8 | | |
| | | 9 | | namespace CoreWCF.Dispatcher |
| | | 10 | | { |
| | | 11 | | public class FaultContractInfo |
| | | 12 | | { |
| | | 13 | | private DataContractSerializer _serializer; |
| | | 14 | | |
| | | 15 | | public FaultContractInfo(string action, Type detail) |
| | 3676 | 16 | | : this(action, detail, null, null, null) |
| | | 17 | | { |
| | 3676 | 18 | | } |
| | 3838 | 19 | | internal FaultContractInfo(string action, Type detail, XmlName elementName, string ns, IList<Type> knownTypes) |
| | | 20 | | { |
| | 3838 | 21 | | Action = action ?? throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull(nameof(action)); |
| | 3838 | 22 | | Detail = detail ?? throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull(nameof(detail)); |
| | 3838 | 23 | | if (elementName != null) |
| | | 24 | | { |
| | 30 | 25 | | ElementName = elementName.EncodedName; |
| | | 26 | | } |
| | | 27 | | |
| | 3838 | 28 | | ElementNamespace = ns; |
| | 3838 | 29 | | KnownTypes = knownTypes; |
| | 3838 | 30 | | } |
| | | 31 | | |
| | 557 | 32 | | public string Action { get; } |
| | | 33 | | |
| | 211 | 34 | | public Type Detail { get; } |
| | | 35 | | |
| | 91 | 36 | | internal string ElementName { get; } |
| | | 37 | | |
| | 30 | 38 | | internal string ElementNamespace { get; } |
| | | 39 | | |
| | 61 | 40 | | internal IList<Type> KnownTypes { get; } |
| | | 41 | | |
| | | 42 | | internal DataContractSerializer Serializer |
| | | 43 | | { |
| | | 44 | | get |
| | | 45 | | { |
| | 65 | 46 | | if (_serializer == null) |
| | | 47 | | { |
| | 61 | 48 | | if (ElementName == null) |
| | | 49 | | { |
| | 31 | 50 | | _serializer = DataContractSerializerDefaults.CreateSerializer(Detail, KnownTypes, int.MaxValue / |
| | | 51 | | } |
| | | 52 | | else |
| | | 53 | | { |
| | 30 | 54 | | _serializer = DataContractSerializerDefaults.CreateSerializer(Detail, KnownTypes, ElementName, E |
| | | 55 | | } |
| | | 56 | | } |
| | 65 | 57 | | return _serializer; |
| | | 58 | | } |
| | | 59 | | } |
| | | 60 | | } |
| | | 61 | | } |