예제 #1
0
 public static void Unsubscribe(string tableName, ChangesTcpService tcpService)
 {
     lock (Subscribers)
     {
         if (!Subscribers.ContainsKey(tableName))
         {
             return;
         }
         Subscribers[tableName] = Subscribers[tableName].RemoveFromReadOnlyList(itm => itm.Id == tcpService.Id);
     }
 }
예제 #2
0
        public static void Subscribe(string tableName, ChangesTcpService changes)
        {
            lock (Subscribers)
            {
                if (!Subscribers.ContainsKey(tableName))
                {
                    Subscribers.Add(tableName, new[] { changes });
                    return;
                }

                Subscribers[tableName] = Subscribers[tableName].AddToReadOnlyList(changes);
            }
        }