如何设置SqlDependency来监控多个表
我试图弄清楚如何使用 SqlDependency 监视多个表。我找到的所有示例都是针对一张表的。
我有多个类代表特定表的监视器。每次引发更改事件时,我都会停止依赖项并启动一个新的依赖项,但这会取消其他监视器的挂钩。如何让它持续监控多个表?每次捕获事件时是否需要重新连接所有监视器?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用AggregateCacheDependency 用于设置对多个表的依赖关系的类。
Use AggregateCacheDependency class to setup dependency on multiple tables.