Real-time applications with SignalR and SQLDependency in ASP.NET MVC

In one of my previous posts, I talked about using SQLDependency as a mechanism for detecting triggers on certain SQL queries. In this post, I’ll talk about how to use this mechanism to display real-time data in web applications using SignalR.

C# trigger after database changes with SQLDependency

I found the following amazing article with some code that works without any modifications. With SQLDependency, you can listen to database changes with a predefined query. If something happens to this result set (INSERT/DELETE/UPDATE) an event will be triggered, allowing you to take action.