Beispiel #1
0
        public override void Publish()
        {
            // Create the QueryHandler
            IQueryHandler queryHandler = new NHibernateQueryHandler(sessionFactory);

            #region Start the WCF server

            ServerQueryWcfHandler wcfServer = new ServerQueryWcfHandler(queryHandler);

            NetTcpBinding netTcpBinding = ServiceHelper.GetNetTcpBinding();
            string serviceUri = ServiceHelper.GetServiceUri(null, null, Artefacts.ServiceConstants.NhibernateServiceName);

            wcfServer.Start(netTcpBinding, serviceUri);

            #endregion

            #region Start the remoting server

            ServerQueryRemotingHandlerNHibernate remotingServer = new ServerQueryRemotingHandlerNHibernate(queryHandler);
            // Register default channel for remote accecss
            Hashtable properties = new Hashtable();
            properties["name"] = Artefacts.ServiceConstants.NhibernateServiceName;
            properties["port"] = Artefacts.ServiceConstants.NhibernatePort;
            IChannel currentChannel = RemotingConstants.GetDefaultChannel(properties);
            ChannelServices.RegisterChannel(currentChannel, false);
            remotingServer.Start(Artefacts.ServiceConstants.NhibernateServiceName, false);

            #endregion
        }
        public override void Publish()
        {
            // Create the QueryHandler
            IQueryHandler queryHandler = new NHibernateQueryHandler(sessionFactory);

            #region Start the WCF server

            ServerQueryWcfHandler wcfServer = new ServerQueryWcfHandler(queryHandler);

            NetTcpBinding netTcpBinding = ServiceHelper.GetNetTcpBinding();
            string        serviceUri    = ServiceHelper.GetServiceUri(null, null, Artefacts.ServiceConstants.NhibernateServiceName);

            wcfServer.Start(netTcpBinding, serviceUri);

            #endregion

            #region Start the remoting server

            ServerQueryRemotingHandlerNHibernate remotingServer = new ServerQueryRemotingHandlerNHibernate(queryHandler);
            // Register default channel for remote accecss
            Hashtable properties = new Hashtable();
            properties["name"] = Artefacts.ServiceConstants.NhibernateServiceName;
            properties["port"] = Artefacts.ServiceConstants.NhibernatePort;
            IChannel currentChannel = RemotingConstants.GetDefaultChannel(properties);
            ChannelServices.RegisterChannel(currentChannel, false);
            remotingServer.Start(Artefacts.ServiceConstants.NhibernateServiceName, false);

            #endregion
        }