数据库架构更改时对 SqlCacheDependency 和 Broker Service 的影响
我正在创建一个具有 Sql 缓存依赖项的应用程序。
启用了代理
Alter database test ENABLE_BROKER
为此,我在向数据库添加两个新表后
。但我发现我无法为我添加的新表获得任何通知服务。
即使我使用
Alter datatbase test New_Broker
这个命令仍在运行,所以我取消它但没有成功。
您能具体说明我缺少什么吗?
有任何帮助吗?
I am creating an application with Sql cached dependency.
For this i enabled the broker by
Alter database test ENABLE_BROKER
After i add two new tables to the database.
But i found that i am not able to get any notification services for the new tables that i added.
Even i use
Alter datatbase test New_Broker
THis command keeps on running so i cancel it without any success.
Can you please specify what i am missing
Any help is apprciated
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您似乎在问两个问题:
如何防止 SET ENABLE_BROKER 挂起
ALTER DATABASE [YourDBName] SET ENABLE_BROKER WITH ROLLBACK IMMEDIATE
架构更改时,您能收到 Service Broker 通知吗?< /p>
通知仅适用于现有表。这可能会导致您考虑尝试注册对 sys.tables 的依赖项,但在通知查询中不允许使用系统视图和表。
您应该能够通过设置插入特殊表的 DDL 触发器,然后针对该表发出查询来解决此问题。例如:
It seems like you're asking two questions:
How to prevent SET ENABLE_BROKER from hanging
ALTER DATABASE [YourDBName] SET ENABLE_BROKER WITH ROLLBACK IMMEDIATE
Can you get notified by Service Broker when the schema changes?
Notifications are for existing tables only. This might lead you to consider trying to register a dependency against sys.tables, but system views and tables are not allowed in a query for notifications.
You should be able to work around this by setting up a DDL trigger that inserts into a special table, and then issue queries against that table. For example: