Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // C:\Windows\Microsoft.NET\Framework\v4.0.30319\csc server.cs /r:Zyan.Communication.dll
- using System;
- using Zyan.Communication;
- namespace DBAccess
- {
- public interface IDBAccess
- {
- event Action<int, string> DataRecv;
- void SetData(int Idx, string text);
- string GetData(int Idx);
- }
- public class CDBAccess : IDBAccess
- {
- string[] Array = new string[100];
- public event Action<int, string> DataRecv;
- public void SetData(int Idx, string text)
- {
- Array[Idx] = text;
- if (DataRecv != null)
- DataRecv(Idx, text);
- }
- public string GetData(int Idx)
- {
- return Array[Idx];
- }
- }
- class Program
- {
- static void Main()
- {
- var host = new ZyanComponentHost("DBAccess", 9010);
- host.RegisterComponent<IDBAccess, CDBAccess>(ActivationType.Singleton);
- Console.ReadLine();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement