//
using System;
using System.Collections.Generic;
+using System.Diagnostics;
using System.ServiceModel;
using System.ServiceModel.Channels;
using System.ServiceModel.Dispatcher;
namespace System.ServiceModel.Description
{
+ [DebuggerDisplay ("Name={name}")]
+ [DebuggerDisplay ("Address={address}")]
public class ServiceEndpoint
{
ContractDescription contract;
public ContractDescription Contract {
get { return contract; }
+#if NET_4_0
+ set {
+ if (value == null)
+ throw new ArgumentNullException ("value");
+ contract = value;
+ }
+#endif
}
public EndpointAddress Address {
set { name = value; }
}
- internal void Validate () {
-#if !NET_2_1
+ internal void Validate ()
+ {
+ if (Contract.Operations.Count == 0)
+ throw new InvalidOperationException (String.Format ("ContractDescription '{0}' has zero operations; a contract must have at least one operation.", Contract.ContractType.Name));
+
foreach (IContractBehavior b in Contract.Behaviors)
b.Validate (Contract, this);
foreach (IEndpointBehavior b in Behaviors)
foreach (IOperationBehavior b in operation.Behaviors)
b.Validate (operation);
}
-#endif
}
var proxy = se.Contract.CreateClientRuntime (callbackDispatchRuntime);
-#if !NET_2_1
foreach (IEndpointBehavior b in se.Behaviors)
b.ApplyClientBehavior (se, proxy);
foreach (IContractBehavior b in se.Contract.Behaviors)
b.ApplyClientBehavior (se.Contract, se, proxy);
-#endif
+
return proxy;
}
}