Пример #1
0
        public override void Publish()
        {
            // Create the QueryHandler
            IQueryHandler queryHandler = new EntityFrameworkQueryHandler(dataContext);

            #region Start the WCF server

            ServerQueryWcfHandler wcfServer = new ServerQueryWcfHandler(queryHandler);

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

            wcfServer.Start(netTcpBinding, serviceUri);

            #endregion

            #region Start the remoting server

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

            #endregion
        }
Пример #2
0
        public override void Publish()
        {
            // Create the QueryHandler
            IQueryHandler queryHandler = new EntityFrameworkQueryHandler(dataContext);

            #region Start the WCF server

            ServerQueryWcfHandler wcfServer = new ServerQueryWcfHandler(queryHandler);

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

            wcfServer.Start(netTcpBinding, serviceUri);

            #endregion

            #region Start the remoting server

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

            #endregion
        }