How to setup SqlDependency to monitor multiple tables

人盡茶涼 提交于 2019-12-23 23:04:07

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!