SQLDependency + Service Broker
问题 I'm using SqlDependency to get notification when data in some table are changed. private void subscribeBroker() { using (var conn = new SqlConnection(connString)) { conn.Open(); var cmd = new SqlCommand("SELECT text FROM dbo.Test"); cmd.Connection = conn; var dependency = new SqlDependency(cmd); dependency.OnChange += dependency_OnChange; SqlDependency.Start(connString); cmd.ExecuteNonQuery(); } } void dependency_OnChange(object sender, SqlNotificationEventArgs e) { //Do something...