C# – Best way to get push notifications to server from MS SQL Server

asp.netcsql server

I partially found a solution to my question, but I'm not really satisfied with the result.

My application consists of ASP.NET MVC + MS SQL Server.

The case is as follows:

  1. An external application saves data periodically to the SQL Database. In one tenth of a second, 20 to 100 records can be saved.
  2. SQL should be polled from the back-end, or there should be push notifications after each save, in order to update (for example) a running total of saved items.
  3. The back-end will push notifications to the UI (this will be done using SignalR)

I followed this tutorial http://venkatbaggu.com/signalr-database-update-notifications-asp-net-mvc-usiing-sql-dependency/ to set it up.

SqlDependency with broker service is used to get push notifications from SQL firing the OnChange Event. The problem is that this solution is very slow. There is only one record saved every second for a small database, and the events fire with pretty big delays.

Is there another technology to get data changes from SQL? Or maybe the solution I'm using requires some kind of optimization?

Best Answer

Have a look at http://sqltabledependency.somee.com/. You can receive notification from SQL Server containing info about the inserted deleted or updated records.

Related Topic