1
private void TableDependency_OnChanged(object sender, System.EventArgs e)
{
   if (((TableDependency.SqlClient.Base.EventArgs.RecordChangedEventArgs
                  <TestTable>)e).ChangeType.ToString() != "Delete")
   {
      string name = e.Entity.Name;
      int id = e.Entity.ID;
      SignalRTestHub.SendAllItemsAsync(id,name);
   }
}

The above code is working fine. But I want to consolidate multiple updates in OnChange to One event trigger. Since there will be more than 100 updates at a time. I want to take only the last update while it is a bulk insert.

eglease
  • 2,445
  • 11
  • 18
  • 28
Code
  • 11
  • 1
  • You'd probably want some sort of queuing mechanism, and every few seconds empty the queue in another task/thread. But why are you doing so many updates together anyway? – Charlieface Aug 07 '23 at 12:19
  • @Charlieface It’s pointing to a DB. And multiple data will be falling on the particular table – Code Aug 07 '23 at 12:38
  • 1
    What you want to do is called "debounce". Take a look at this, it should be useful: https://stackoverflow.com/questions/28472205/c-sharp-event-debounce – Tao Gómez Gil Aug 07 '23 at 12:41
  • @TaoGómezGil Thanks – Code Aug 08 '23 at 04:44

0 Answers0