Inheritance: IDiscoveryProxyContract11, IDiscoveryProxyContractApril2005, IDiscoveryProxyContractCD1, IDiscoveryTargetContract11, IDiscoveryTargetContractApril2005, IDiscoveryTargetContractCD1
        void IServiceBehavior.ApplyDispatchBehavior(ServiceDescription serviceDescription, ServiceHostBase serviceHostBase)
        {
            if (serviceDescription == null)
            {
                throw FxTrace.Exception.ArgumentNull("serviceDescription");
            }
            if (serviceHostBase == null)
            {
                throw FxTrace.Exception.ArgumentNull("serviceHostBase");
            }

            DiscoveryServiceExtension discoveryServiceExtension = serviceHostBase.Extensions.Find <DiscoveryServiceExtension>();

            if (discoveryServiceExtension != null)
            {
                DiscoveryService discoveryService = discoveryServiceExtension.ValidateAndGetDiscoveryService();

                ServiceDiscoveryBehavior.SetDiscoveryImplementation(serviceHostBase, discoveryService);

                if (this.announcementEndpoints.Count > 0)
                {
                    serviceHostBase.ChannelDispatchers.Add(
                        new OnlineAnnouncementChannelDispatcher(
                            serviceHostBase,
                            this.announcementEndpoints,
                            discoveryServiceExtension.InternalPublishedEndpoints,
                            discoveryService.MessageSequenceGenerator));

                    serviceHostBase.ChannelDispatchers.Insert(0,
                                                              new OfflineAnnouncementChannelDispatcher(
                                                                  serviceHostBase,
                                                                  this.announcementEndpoints,
                                                                  discoveryServiceExtension.InternalPublishedEndpoints,
                                                                  discoveryService.MessageSequenceGenerator));
                }
            }
        }
 internal ServiceDiscoveryInstanceContextProvider(DiscoveryService discoveryService)
 {
     Fx.Assert(discoveryService != null, "The discoveryService must be non null.");
     this.discoveryService = discoveryService;
 }
 static void SetDiscoveryImplementation(EndpointDispatcher endpointDispatcher, DiscoveryService discoveryService)
 {
     DispatchRuntime dispatchRuntime = endpointDispatcher.DispatchRuntime;
     dispatchRuntime.SynchronizationContext = null;
     dispatchRuntime.ConcurrencyMode = ConcurrencyMode.Multiple;
     ServiceDiscoveryInstanceContextProvider provider = new ServiceDiscoveryInstanceContextProvider(discoveryService);
     dispatchRuntime.InstanceContextProvider = provider;
     dispatchRuntime.InstanceProvider = provider;
     dispatchRuntime.Type = discoveryService.GetType();
 }
 static void SetDiscoveryImplementation(ServiceHostBase host, DiscoveryService discoveryService)
 {
     foreach (ChannelDispatcherBase channelDispatcherBase in host.ChannelDispatchers)
     {
         ChannelDispatcher channelDispatcher = channelDispatcherBase as ChannelDispatcher;
         if (channelDispatcher != null)
         {
             foreach (EndpointDispatcher endpointDispatcher in channelDispatcher.Endpoints)
             {
                 if ((endpointDispatcher != null) && EndpointDiscoveryMetadata.IsDiscoverySystemEndpoint(endpointDispatcher))
                 {
                     SetDiscoveryImplementation(endpointDispatcher, discoveryService);
                 }
             }
         }
     }
 }
 protected virtual bool Validate(TResolveMessage resolveMessage)
 {
     return(DiscoveryService.EnsureMessageId() &&
            this.ValidateContent(resolveMessage) &&
            this.EnsureNotDuplicate());
 }
        static void SetDiscoveryImplementation(EndpointDispatcher endpointDispatcher, DiscoveryService discoveryService)
        {
            DispatchRuntime dispatchRuntime = endpointDispatcher.DispatchRuntime;

            dispatchRuntime.SynchronizationContext = null;
            dispatchRuntime.ConcurrencyMode        = ConcurrencyMode.Multiple;
            ServiceDiscoveryInstanceContextProvider provider = new ServiceDiscoveryInstanceContextProvider(discoveryService);

            dispatchRuntime.InstanceContextProvider = provider;
            dispatchRuntime.InstanceProvider        = provider;
            dispatchRuntime.Type = discoveryService.GetType();
        }
Esempio n. 7
0
 internal ServiceDiscoveryInstanceContextProvider(DiscoveryService discoveryService)
 {
     Fx.Assert(discoveryService != null, "The discoveryService must be non null.");
     this.discoveryService = discoveryService;
 }