Beispiel #1
0
 public override int GetHashCode()
 {
     return(string.Concat(string.Concat(string.Concat(EndpointId.ToString("d8-"), Cabina), EndpointIP), CustomerAcctId.ToString()).GetHashCode());
 }
        /// <summary>
        /// Attaches a new endpoint to the given host.
        /// </summary>
        /// <param name="host">The host to which the endpoint should be attached.</param>
        /// <param name="implementedContract">The contract implemented by the endpoint.</param>
        /// <param name="localEndpoint">The ID of the local endpoint, to be used in the endpoint metadata.</param>
        /// <param name="allowAutomaticChannelDiscovery">
        /// A flag that indicates whether or not the channel should provide automatic channel discovery.
        /// </param>
        /// <returns>The newly attached endpoint.</returns>
        public ServiceEndpoint AttachDiscoveryEntryEndpoint(
            ServiceHost host,
            Type implementedContract,
            EndpointId localEndpoint,
            bool allowAutomaticChannelDiscovery)
        {
            var endpoint = host.AddServiceEndpoint(implementedContract, GenerateBinding(), GenerateNewDiscoveryEntryAddress());

            if (allowAutomaticChannelDiscovery)
            {
                var discoveryBehavior = new ServiceDiscoveryBehavior();
                discoveryBehavior.AnnouncementEndpoints.Add(new UdpAnnouncementEndpoint());
                host.Description.Behaviors.Add(discoveryBehavior);
                host.Description.Endpoints.Add(new UdpDiscoveryEndpoint());
            }

            var endpointDiscoveryBehavior = new EndpointDiscoveryBehavior();

            endpointDiscoveryBehavior.Extensions.Add(new XElement("root", new XElement("EndpointId", localEndpoint.ToString())));
            endpoint.Behaviors.Add(endpointDiscoveryBehavior);

            return(endpoint);
        }
Beispiel #3
0
 public override string ToString()
 {
     return(_id.ToString());
 }