How to setup SqlDependency to monitor multiple tables
-
25-09-2019 - |
Question
I am trying to figure out how to monitor more than one table with a SqlDependency. All the examples I have found are for one table.
I have multiple classes that represent a monitor for a specific table. Each time a change event is raised I stop the dependency and start a new one but that unhooks the other monitors. How do I get it to keep monitoring for multiple tables? Do I need to re-hookup all the monitors each time an event is caught?
Solution
Use AggregateCacheDependency class to setup dependency on multiple tables.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow