This project is read-only.

SqlTableDependency

This class it is used to monitor changed on a specific table. Every insert/update/delete operation done on the table, trigger an C# event, containing the values for the changed record.

Overview

SqlTableDependency implement the IDisposable interface to provides a mechanism for destroying database resources generated to receive table change notifications. To take advantage of that, use the using statement pattern.

SqlTableDependency implement the generic pattern allow you to delay the specification of the data type used to be filled in the the value for the changed record.

Note: When you use notifications, you must be sure to enable Service Broker for the database. To do that you can use the following command:

ALTER DATABASE MyDatabase SET ENABLE_BROKER

Limitations

List of not managed columns.

Constructors

Name Description
SqlTableDependency(string, string, ModelToTableMapper<T> = null, IEnumerable<string> = null, bool = true, string = null) Creates a new instance of the SqlTableDependency class, associates it with the connection string and table parameter.

Events

Name Description
OnChange Occurs when a notification is received for any of the change done on the monitored table.
OnError Occurs when a exception is received during the listening stage.

Properties

Name Description
DataBaseObjectsNamingConvention Naming convention used to create all database objects used to receive notifications.
Status SqlTableDependency status.

Methods

Name Description
Start(int, int) Create database objects and start waiting for notifications.
Stop() Stop listen for notification and destroy database objects.


Last edited Dec 3, 2016 at 6:01 PM by delbianco, version 45