Exemple #1
0
        public SdbConnector(string host, bool cache)
        {
            Name = host;

            var client = new EncryptedTcpClient(host);

            //_service = new MysqlDataService("Server=localhost;Database=sdb;User ID=root;CharSet=utf8");
            //_service = new MemoryDataService();
            DataService = new TcpDataService(client);

            if (cache)
                DataService = new CacheDataService(DataService);

            var authenticator = new TcpBasicClientAuthenticator(DataService, client);

            DataService = new AuthDataService(DataService, authenticator);

            try
            {
                authenticator.Login("sorenhk", "abc");
            }
            catch (AuthException e)
            {
                MessageBox.Show(e.Message);
                return;
            }

            ObjectMapper = new ObjectMapper(DataService, authenticator.UserWorkspaceContainerId);
        }
Exemple #2
0
        static void Main(string[] args)
        {
            Debug.Listeners.Add(new TextWriterTraceListener(Console.Out));

            DataServiceBase service = new TcpDataService(new TcpClient("home.sorenhk.dk"));
            service = new CacheDataService(service);

            var tcpServer = new TcpServer();

            var server = new TcpDataServiceServer(service);
            server.RegisterTo(tcpServer);

            Console.ReadLine();

            tcpServer.Dispose();
            service.Dispose();
        }