A C# component that provides SQL Server record change notifications, delivering updated values without polling.
SqlTableDependency is a C# library that provides real-time notifications for SQL Server table changes. It solves the problem of continuous database polling by leveraging SQL Server's Service Broker to deliver change events directly to .NET applications, including the actual record values that were inserted, updated, or deleted.
.NET developers building applications that need to react immediately to database changes, such as real-time dashboards, synchronization tools, or audit systems.
Developers choose SqlTableDependency because it delivers actual changed record values in notifications (unlike SqlDependency), supports flexible model mapping, and handles the complex SQL Server infrastructure automatically, making real-time data tracking straightforward.
Get SQL Server notification on record table change
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Notifications include the actual changed record values for INSERT, UPDATE, and DELETE operations, eliminating the need for additional SELECT queries to retrieve updates, as shown in the example code.
The ModelToTableMapper allows mapping C# model properties to table columns with different names, providing flexibility in data representation without altering the database schema.
SqlTableDependency automatically creates and cleans up SQL Server objects like triggers and Service Broker components, with a watchdog to remove them if the application stops abruptly, reducing manual maintenance.
Optional inclusion of old values in update notifications enables comprehensive audit trails without custom tracking code, as mentioned in the features section.
Requires extensive database permissions (e.g., ALTER, CREATE CONTRACT) and enabling Service Broker, which can be a barrier in locked-down environments and is explicitly listed in the audit requirements.
If the database connection is lost, the SqlTableDependency instance cannot reconnect; a new instance must be created, potentially leading to data gaps, as admitted in the README's requirements section.
Does not support several SQL Server column types such as XML, IMAGE, and GEOGRAPHY, restricting its use with certain database schemas, as noted in the 'Not supported' section.
The watchdog system can prematurely clean up database objects during debugging if the timeout is not increased, causing interruptions in development, as warned in the README's remarks.