问题
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?
回答1:
Use AggregateCacheDependency class to setup dependency on multiple tables.
来源:https://stackoverflow.com/questions/2803244/how-to-setup-sqldependency-to-monitor-multiple-tables