GetBindingFromMetadata() static private méthode

static private GetBindingFromMetadata ( EndpointDiscoveryMetadata metadata ) : System.ServiceModel.Channels.Binding
metadata System.ServiceModel.Discovery.EndpointDiscoveryMetadata
Résultat System.ServiceModel.Channels.Binding
        private DiscoveryEndpoint DiscoverEndpoint(DiscoveryEndpoint endpoint, bool required)
        {
            using (var discover = new DiscoveryClient(UdpDiscoveryEndpoint ?? new UdpDiscoveryEndpoint()))
            {
                var criteria = new FindCriteria(endpoint.Contract.ContractType)
                {
                    MaxResults = 1
                };
                if (DiscoveryDuration.HasValue)
                {
                    criteria.Duration = DiscoveryDuration.Value;
                }

                var discovered = discover.Find(criteria);
                if (discovered.Endpoints.Count > 0)
                {
                    var endpointMetadata = discovered.Endpoints[0];
                    var binding          = Binding ?? AbstractChannelBuilder.GetBindingFromMetadata(endpointMetadata);
                    return(new DiscoveryEndpoint(binding, endpointMetadata.Address));
                }

                if (required)
                {
                    throw new EndpointNotFoundException("Unable to locate a ServiceCatalog on the network.");
                }

                return(null);
            }
        }
        public override DiscoveryEndpoint GetDiscoveryEndpoint()
        {
            var forContract = DiscoveryVersion != null
                                ? new DiscoveryEndpoint(DiscoveryVersion, ServiceDiscoveryMode.Managed)
                                : new DiscoveryEndpoint();

            using (var discover = new DiscoveryClient(GetUdpDiscoveryEndpoint()))
            {
                var criteria = GetSearchCriteria(forContract.Contract.ContractType);
                RestrictDomain(criteria);

                var discovered = discover.Find(criteria);
                if (discovered.Endpoints.Count > 0)
                {
                    var endpointMetadata = discovered.Endpoints[0];
                    var binding          = AbstractChannelBuilder.GetBindingFromMetadata(endpointMetadata);
                    return(new DiscoveryEndpoint(binding, endpointMetadata.Address));
                }
            }

            return(null);
        }