Example #1
0
        public static void BroadcastRowsUpdate(DbTable dbTable, IReadOnlyList <DbRow> entities)
        {
            var connections = TableSubscribers.GetConnections(dbTable.Name);

            if (connections == null)
            {
                return;
            }

            var packetToBroadcast = new UpdateRowsContract
            {
                TableName = dbTable.Name,
                Data      = entities.ToHubUpdateContract()
            };

            foreach (var connection in connections)
            {
                connection.SendPacket(packetToBroadcast);
            }
        }
Example #2
0
        public static void BroadcastInitTable(DbTable dbTable)
        {
            var connections = TableSubscribers.GetConnections(dbTable.Name);

            if (connections == null)
            {
                return;
            }

            var packetToBroadcast = new InitTableContract
            {
                TableName = dbTable.Name,
                Data      = dbTable.GetAllRecords(null).ToHubUpdateContract()
            };

            foreach (var connection in connections)
            {
                connection.SendPacket(packetToBroadcast);
            }
        }
Example #3
0
        public static void BroadcastRowsDelete(DbTable dbTable, IReadOnlyList <DbRow> dbRows)
        {
            var connections = TableSubscribers.GetConnections(dbTable.Name);

            if (connections == null)
            {
                return;
            }

            var packetToBroadcast = new DeleteRowsContract
            {
                TableName    = dbTable.Name,
                RowsToDelete = dbRows.Select(row => (row.PartitionKey, row.RowKey)).ToList()
            };

            foreach (var connection in connections)
            {
                connection.SendPacket(packetToBroadcast);
            }
        }
Example #4
0
        public static void BroadcastInitPartition(DbTable dbTable, DbPartition partition)
        {
            var connections = TableSubscribers.GetConnections(dbTable.Name);

            if (connections == null)
            {
                return;
            }

            var packetToBroadcast = new InitPartitionContract
            {
                TableName    = dbTable.Name,
                PartitionKey = partition.PartitionKey,
                Data         = partition.GetAllRows().ToHubUpdateContract()
            };

            foreach (var connection in connections)
            {
                connection.SendPacket(packetToBroadcast);
            }
        }