2 // ReliableSessionElement.cs
5 // Atsushi Enomoto <atsushi@ximian.com>
7 // Copyright (C) 2006 Novell, Inc. http://www.novell.com
9 // Permission is hereby granted, free of charge, to any person obtaining
10 // a copy of this software and associated documentation files (the
11 // "Software"), to deal in the Software without restriction, including
12 // without limitation the rights to use, copy, modify, merge, publish,
13 // distribute, sublicense, and/or sell copies of the Software, and to
14 // permit persons to whom the Software is furnished to do so, subject to
15 // the following conditions:
17 // The above copyright notice and this permission notice shall be
18 // included in all copies or substantial portions of the Software.
20 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
22 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
23 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
24 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
25 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
26 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
30 using System
.Collections
;
31 using System
.Collections
.Generic
;
32 using System
.Collections
.ObjectModel
;
33 using System
.ComponentModel
;
34 using System
.Configuration
;
36 using System
.Net
.Security
;
37 using System
.Reflection
;
38 using System
.Security
.Cryptography
.X509Certificates
;
39 using System
.Security
.Principal
;
40 using System
.IdentityModel
.Claims
;
41 using System
.IdentityModel
.Policy
;
42 using System
.IdentityModel
.Tokens
;
43 using System
.ServiceModel
;
44 using System
.ServiceModel
.Channels
;
45 using System
.ServiceModel
.Description
;
46 using System
.ServiceModel
.Diagnostics
;
47 using System
.ServiceModel
.Dispatcher
;
48 using System
.ServiceModel
.MsmqIntegration
;
49 using System
.ServiceModel
.PeerResolvers
;
50 using System
.ServiceModel
.Security
;
51 using System
.Runtime
.Serialization
;
55 namespace System
.ServiceModel
.Configuration
57 public sealed class ReliableSessionElement
58 : BindingElementExtensionElement
60 public ReliableSessionElement () {
65 [ConfigurationProperty ("acknowledgementInterval",
66 Options
= ConfigurationPropertyOptions
.None
,
67 DefaultValue
= "00:00:00.2")]
68 [TypeConverter (typeof (TimeSpanConverter
))]
69 public TimeSpan AcknowledgementInterval
{
70 get { return (TimeSpan) base ["acknowledgementInterval"]; }
71 set { base ["acknowledgementInterval"] = value; }
74 public override Type BindingElementType
{
75 get { return typeof (ReliableSessionBindingElement); }
78 [ConfigurationProperty ("flowControlEnabled",
79 Options
= ConfigurationPropertyOptions
.None
,
81 public bool FlowControlEnabled
{
82 get { return (bool) base ["flowControlEnabled"]; }
83 set { base ["flowControlEnabled"] = value; }
86 [ConfigurationProperty ("inactivityTimeout",
87 Options
= ConfigurationPropertyOptions
.None
,
88 DefaultValue
= "00:10:00")]
89 [TypeConverter (typeof (TimeSpanConverter
))]
90 public TimeSpan InactivityTimeout
{
91 get { return (TimeSpan) base ["inactivityTimeout"]; }
92 set { base ["inactivityTimeout"] = value; }
95 [ConfigurationProperty ("maxPendingChannels",
96 Options
= ConfigurationPropertyOptions
.None
,
98 [IntegerValidator (MinValue
= 1,
100 ExcludeRange
= false)]
101 public int MaxPendingChannels
{
102 get { return (int) base ["maxPendingChannels"]; }
103 set { base ["maxPendingChannels"] = value; }
106 [IntegerValidator (MinValue
= 1,
107 MaxValue
= int.MaxValue
,
108 ExcludeRange
= false)]
109 [ConfigurationProperty ("maxRetryCount",
110 Options
= ConfigurationPropertyOptions
.None
,
112 public int MaxRetryCount
{
113 get { return (int) base ["maxRetryCount"]; }
114 set { base ["maxRetryCount"] = value; }
117 [ConfigurationProperty ("maxTransferWindowSize",
118 Options
= ConfigurationPropertyOptions
.None
,
120 [IntegerValidator (MinValue
= 1,
122 ExcludeRange
= false)]
123 public int MaxTransferWindowSize
{
124 get { return (int) this ["maxTransferWindowSize"]; }
125 set { this ["maxTransferWindowSize"] = value; }
128 [ConfigurationProperty ("ordered",
129 Options
= ConfigurationPropertyOptions
.None
,
130 DefaultValue
= true)]
131 public bool Ordered
{
132 get { return (bool) this ["ordered"]; }
133 set { this ["ordered"] = value; }
136 [ConfigurationPropertyAttribute ("reliableMessagingVersion",
137 DefaultValue
= "WSReliableMessagingFebruary2005")]
138 [TypeConverter (typeof (ReliableMessagingVersionConverter
))]
139 public ReliableMessagingVersion ReliableMessagingVersion
{
140 get { return (ReliableMessagingVersion) this ["reliableMessagingVersion"]; }
141 set { this ["reliableMessagingVersion"] = value; }
144 protected override ConfigurationPropertyCollection Properties
{
145 get { return base.Properties; }
148 protected internal override BindingElement
CreateBindingElement ()
150 return new ReliableSessionBindingElement ();
153 public override void ApplyConfiguration (BindingElement element
)
155 var b
= (ReliableSessionBindingElement
) element
;
156 b
.AcknowledgementInterval
= AcknowledgementInterval
;
157 b
.FlowControlEnabled
= FlowControlEnabled
;
158 b
.InactivityTimeout
= InactivityTimeout
;
159 b
.MaxPendingChannels
= MaxPendingChannels
;
160 b
.MaxRetryCount
= MaxRetryCount
;
161 b
.MaxTransferWindowSize
= MaxTransferWindowSize
;
163 b
.ReliableMessagingVersion
= ReliableMessagingVersion
;
166 public override void CopyFrom (ServiceModelExtensionElement element
)
168 var b
= (ReliableSessionElement
) element
;
169 AcknowledgementInterval
= b
.AcknowledgementInterval
;
170 FlowControlEnabled
= b
.FlowControlEnabled
;
171 InactivityTimeout
= b
.InactivityTimeout
;
172 MaxPendingChannels
= b
.MaxPendingChannels
;
173 MaxRetryCount
= b
.MaxRetryCount
;
174 MaxTransferWindowSize
= b
.MaxTransferWindowSize
;
176 ReliableMessagingVersion
= b
.ReliableMessagingVersion
;
179 protected internal override void InitializeFrom (BindingElement element
)
181 var b
= (ReliableSessionBindingElement
) element
;
182 AcknowledgementInterval
= b
.AcknowledgementInterval
;
183 FlowControlEnabled
= b
.FlowControlEnabled
;
184 InactivityTimeout
= b
.InactivityTimeout
;
185 MaxPendingChannels
= b
.MaxPendingChannels
;
186 MaxRetryCount
= b
.MaxRetryCount
;
187 MaxTransferWindowSize
= b
.MaxTransferWindowSize
;
189 ReliableMessagingVersion
= b
.ReliableMessagingVersion
;