1 using System; 2 using System.Collections.Generic; 3 using System.Collections.ObjectModel; 4 using System.ServiceModel; 5 using System.ServiceModel.Channels; 6 using System.ServiceModel.Description; 7 using System.ServiceModel.Dispatcher; 8 9 namespace System.ServiceModel.Discovery 10 { 11 public class DynamicEndpoint : ServiceEndpoint 12 { DynamicEndpoint(ContractDescription contract, Binding binding)13 public DynamicEndpoint (ContractDescription contract, Binding binding) 14 : base (contract, CreateBinding (binding), new EndpointAddress ("http://schemas.microsoft.com/discovery/dynamic")) 15 { 16 if (binding == null) 17 throw new ArgumentNullException ("binding"); 18 DiscoveryEndpointProvider = DiscoveryEndpointProvider.CreateDefault (); 19 FindCriteria = new FindCriteria (contract.ContractType); 20 21 IsSystemEndpoint = true; 22 } 23 CreateBinding(Binding source)24 static CustomBinding CreateBinding (Binding source) 25 { 26 var bec = source.CreateBindingElements (); 27 bec.Insert (0, new DiscoveryClientBindingElement ()); 28 return new CustomBinding (bec); 29 } 30 31 public DiscoveryEndpointProvider DiscoveryEndpointProvider { get; set; } 32 public FindCriteria FindCriteria { get; set; } 33 } 34 } 35