1 //------------------------------------------------------------------------------
2 // Copyright (c) Microsoft Corporation.  All rights reserved.
3 //------------------------------------------------------------------------------
4 
5 namespace System.ServiceModel.Configuration
6 {
7     using System.Configuration;
8     using System.ServiceModel.Description;
9     using System.Collections.Generic;
10 
11     public sealed partial class ServiceDebugElement : BehaviorExtensionElement
12     {
ServiceDebugElement()13         public ServiceDebugElement()
14         {
15         }
16 
17         [ConfigurationProperty(ConfigurationStrings.HttpHelpPageEnabled, DefaultValue = true)]
18         public bool HttpHelpPageEnabled
19         {
20             get { return (bool)base[ConfigurationStrings.HttpHelpPageEnabled]; }
21             set { base[ConfigurationStrings.HttpHelpPageEnabled] = value; }
22         }
23 
24         [ConfigurationProperty(ConfigurationStrings.HttpHelpPageUrl)]
25         public Uri HttpHelpPageUrl
26         {
27             get { return (Uri)base[ConfigurationStrings.HttpHelpPageUrl]; }
28             set { base[ConfigurationStrings.HttpHelpPageUrl] = value; }
29         }
30 
31         [ConfigurationProperty(ConfigurationStrings.HttpsHelpPageEnabled, DefaultValue = true)]
32         public bool HttpsHelpPageEnabled
33         {
34             get { return (bool)base[ConfigurationStrings.HttpsHelpPageEnabled]; }
35             set { base[ConfigurationStrings.HttpsHelpPageEnabled] = value; }
36         }
37 
38         [ConfigurationProperty(ConfigurationStrings.HttpsHelpPageUrl)]
39         public Uri HttpsHelpPageUrl
40         {
41             get { return (Uri)base[ConfigurationStrings.HttpsHelpPageUrl]; }
42             set { base[ConfigurationStrings.HttpsHelpPageUrl] = value; }
43         }
44 
45         [ConfigurationProperty(ConfigurationStrings.HttpHelpPageBinding, DefaultValue = "")]
46         [StringValidator(MinLength = 0)]
47         public string HttpHelpPageBinding
48         {
49             get { return (string)base[ConfigurationStrings.HttpHelpPageBinding]; }
50             set { base[ConfigurationStrings.HttpHelpPageBinding] = value; }
51         }
52 
53         [ConfigurationProperty(ConfigurationStrings.HttpHelpPageBindingConfiguration, DefaultValue = "")]
54         [StringValidator(MinLength = 0)]
55         public string HttpHelpPageBindingConfiguration
56         {
57             get { return (string)base[ConfigurationStrings.HttpHelpPageBindingConfiguration]; }
58             set { base[ConfigurationStrings.HttpHelpPageBindingConfiguration] = value; }
59         }
60 
61         [ConfigurationProperty(ConfigurationStrings.HttpsHelpPageBinding, DefaultValue = "")]
62         [StringValidator(MinLength = 0)]
63         public string HttpsHelpPageBinding
64         {
65             get { return (string)base[ConfigurationStrings.HttpsHelpPageBinding]; }
66             set { base[ConfigurationStrings.HttpsHelpPageBinding] = value; }
67         }
68 
69         [ConfigurationProperty(ConfigurationStrings.HttpsHelpPageBindingConfiguration, DefaultValue = "")]
70         [StringValidator(MinLength = 0)]
71         public string HttpsHelpPageBindingConfiguration
72         {
73             get { return (string)base[ConfigurationStrings.HttpsHelpPageBindingConfiguration]; }
74             set { base[ConfigurationStrings.HttpsHelpPageBindingConfiguration] = value; }
75         }
76 
77         [ConfigurationProperty(ConfigurationStrings.IncludeExceptionDetailInFaults, DefaultValue = false)]
78         public bool IncludeExceptionDetailInFaults
79         {
80             get { return (bool)base[ConfigurationStrings.IncludeExceptionDetailInFaults]; }
81             set { base[ConfigurationStrings.IncludeExceptionDetailInFaults] = value; }
82         }
83 
CopyFrom(ServiceModelExtensionElement from)84         public override void CopyFrom(ServiceModelExtensionElement from)
85         {
86             base.CopyFrom(from);
87 
88             ServiceDebugElement source = (ServiceDebugElement)from;
89 #pragma warning suppress 56506 //Microsoft; base.CopyFrom() check for 'from' being null
90             this.HttpHelpPageEnabled = source.HttpHelpPageEnabled;
91             this.HttpHelpPageUrl = source.HttpHelpPageUrl;
92             this.HttpsHelpPageEnabled = source.HttpsHelpPageEnabled;
93             this.HttpsHelpPageUrl = source.HttpsHelpPageUrl;
94             this.IncludeExceptionDetailInFaults = source.IncludeExceptionDetailInFaults;
95             this.HttpHelpPageBinding = source.HttpHelpPageBinding;
96             this.HttpHelpPageBindingConfiguration = source.HttpHelpPageBindingConfiguration;
97             this.HttpsHelpPageBinding = source.HttpsHelpPageBinding;
98             this.HttpsHelpPageBindingConfiguration = source.HttpsHelpPageBindingConfiguration;
99 
100         }
101 
CreateBehavior()102         protected internal override object CreateBehavior()
103         {
104             ServiceDebugBehavior behavior = new ServiceDebugBehavior();
105 
106             behavior.HttpHelpPageEnabled = this.HttpHelpPageEnabled;
107             behavior.HttpHelpPageUrl = this.HttpHelpPageUrl;
108             behavior.HttpsHelpPageEnabled = this.HttpsHelpPageEnabled;
109             behavior.HttpsHelpPageUrl = this.HttpsHelpPageUrl;
110             behavior.IncludeExceptionDetailInFaults = this.IncludeExceptionDetailInFaults;
111             if (!String.IsNullOrEmpty(this.HttpHelpPageBinding))
112                 behavior.HttpHelpPageBinding = ConfigLoader.LookupBinding(this.HttpHelpPageBinding, this.HttpHelpPageBindingConfiguration);
113             if (!String.IsNullOrEmpty(this.HttpsHelpPageBinding))
114                 behavior.HttpsHelpPageBinding = ConfigLoader.LookupBinding(this.HttpsHelpPageBinding, this.HttpsHelpPageBindingConfiguration);
115 
116             return behavior;
117         }
118 
119         public override Type BehaviorType
120         {
121             get { return typeof(ServiceDebugBehavior); }
122         }
123     }
124 }
125 
126 
127 
128 
129