Beispiel #1
0
        static void Main(string[] args)
        {
            BinaryServerFormatterSinkProvider serverProvider = new BinaryServerFormatterSinkProvider();

            serverProvider.TypeFilterLevel = System.Runtime.Serialization.Formatters.TypeFilterLevel.Full;
            BinaryClientFormatterSinkProvider clientProvider = new BinaryClientFormatterSinkProvider();
            IDictionary pro = new Hashtable();

            pro["port"] = 55555;
            TcpChannel channel = new TcpChannel(pro, clientProvider, serverProvider);

            ChannelServices.RegisterChannel(channel, false);


            IDictionary <string, string> props = new Dictionary <string, string>();

            props.Add("connectionString", GetConnectionStringByName("excursiiDB"));

            IAgentRepository     agentRepository     = new RepositoryAgent(props);
            IRezervareRepository rezervareRepository = new RepositoryRezervare(props);
            IExcursieRepository  excursieRepository  = new RepositoryExcursie(props);
            Service s = new Service(agentRepository, excursieRepository, rezervareRepository);

            RemotingServices.Marshal(s, "app");

            // SerialServer server = new SerialServer("127.0.0.1", 55555, s);
            // server.Start();
            Console.WriteLine("Server started ...");

            Console.ReadLine();
        }
Beispiel #2
0
        static void Main(string[] args)
        {
            IDictionary <string, string> props = new Dictionary <string, string>();

            //props.Add("connectionString", GetConnectionStringByName("excursiiDB"));
            props.Add("connectionString", "Data Source=D:\\Documents\\MPP\\Laborator\\proiectLaboratordb.db;Version=3;");
            IAgentRepository     agentRepository     = new RepositoryAgent(props);
            IRezervareRepository rezervareRepository = new RepositoryRezervare(props);
            IExcursieRepository  excursieRepository  = new RepositoryExcursie(props);
            Service s = new Service(agentRepository, excursieRepository, rezervareRepository);


            SerialServer server = new SerialServer("127.0.0.1", 55555, s);

            server.Start();
            Console.WriteLine("Server started ...");

            Console.ReadLine();
        }