ソースを参照

2009-04-07 Atsushi Enomoto <[email protected]>

	* XmlDictionaryReaderQuotasElement.cs, NetTcpBindingElement.cs:
	  implement OnApplyConfiguration().


svn path=/trunk/mcs/; revision=131202
Atsushi Eno 16 年 前
コミット
b4731ac3cc

+ 5 - 0
mcs/class/System.ServiceModel/System.ServiceModel.Configuration/ChangeLog

@@ -1,3 +1,8 @@
+2009-04-07  Atsushi Enomoto  <[email protected]>
+
+	* XmlDictionaryReaderQuotasElement.cs, NetTcpBindingElement.cs:
+	  implement OnApplyConfiguration().
+
 2008-04-22  Igor Zelmanovich <[email protected]>
 
 	* ServiceDebugElement.cs:

+ 35 - 3
mcs/class/System.ServiceModel/System.ServiceModel.Configuration/NetTcpBindingElement.cs

@@ -170,6 +170,7 @@ namespace System.ServiceModel.Configuration
 			get { return (XmlDictionaryReaderQuotasElement) this ["readerQuotas"]; }
 		}
 
+		[MonoTODO ("This configuration prpperty is not applied yet")]
 		[ConfigurationProperty ("reliableSession",
 			 Options = ConfigurationPropertyOptions.None)]
 		public StandardBindingOptionalReliableSessionElement ReliableSession {
@@ -207,10 +208,41 @@ namespace System.ServiceModel.Configuration
 			set { this ["transferMode"] = value; }
 		}
 
+		protected override void OnApplyConfiguration (Binding binding)
+		{
+			NetTcpBinding n = (NetTcpBinding) binding;
+			n.CloseTimeout = CloseTimeout;
+			n.HostNameComparisonMode = HostNameComparisonMode;
+			n.ListenBacklog = ListenBacklog;
+			n.MaxBufferPoolSize = MaxBufferPoolSize;
+			n.MaxBufferSize = MaxBufferSize;
+			n.MaxConnections = MaxConnections;
+			n.MaxReceivedMessageSize = MaxReceivedMessageSize;
+			n.OpenTimeout = OpenTimeout;
+			n.PortSharingEnabled = PortSharingEnabled;
+			if (ReaderQuotas != null)
+				n.ReaderQuotas = ReaderQuotas.Create ();
+			n.ReceiveTimeout = ReceiveTimeout;
+
+			// FIXME: apply this too.
+			//ReliableSession.ApplyTo (n.ReliableSession);
+
+			if (Security != null) {
+				n.Security.Mode = Security.Mode;
+				if (Security.Message != null) {
+					n.Security.Message.AlgorithmSuite = Security.Message.AlgorithmSuite;
+					n.Security.Message.ClientCredentialType = Security.Message.ClientCredentialType;
+				}
+				if (Security.Transport != null) {
+					n.Security.Transport.ClientCredentialType = Security.Transport.ClientCredentialType;
+					n.Security.Transport.ProtectionLevel = Security.Transport.ProtectionLevel;
+				}
+			}
 
-
-		protected override void OnApplyConfiguration (Binding binding) {
-			throw new NotImplementedException ();
+			n.SendTimeout = SendTimeout;
+			n.TransactionFlow = TransactionFlow;
+			n.TransactionProtocol = TransactionProtocol;
+			n.TransferMode = TransferMode;
 		}
 	}
 

+ 15 - 1
mcs/class/System.ServiceModel/System.ServiceModel.Configuration/XmlDictionaryReaderQuotasElement.cs

@@ -162,7 +162,21 @@ namespace System.ServiceModel.Configuration
 			get { return properties; }
 		}
 
-
+		internal XmlDictionaryReaderQuotas Create ()
+		{
+			var q =  new XmlDictionaryReaderQuotas ();
+			if (MaxArrayLength > 0)
+				q.MaxArrayLength = MaxArrayLength;
+			if (MaxBytesPerRead > 0)
+				q.MaxBytesPerRead = MaxBytesPerRead;
+			if (MaxDepth > 0)
+				q.MaxDepth = MaxDepth;
+			if (MaxNameTableCharCount > 0)
+				q.MaxNameTableCharCount = MaxNameTableCharCount;
+			if (MaxStringContentLength > 0)
+				q.MaxStringContentLength = MaxStringContentLength;
+			return q;
+		}
 	}
 
 }