数据库变更通知 [英] Notification about Database Change
问题描述
我正在尝试一种方案,在该方案中,我想使用任何用户提交的更改来更新在不同 PC 上运行的桌面 UI.例如:
I am trying a scenario in which I want to update my desktop UI running on different PCs with changes committed by any user. For example:
- Application1 安装在 PC1、PC2 和 PC3 上.
- 假设所有 PC 都在运行此应用程序.
- 说 PC1 上的用户 1 更改数据并提交到数据库
- PC2 和 PC3 上的 UI 应根据更改进行更新,而无需轮询或从数据库中提取数据.
任何人都可以建议一种方法来通知我的中间层服务有关数据库更改的信息,然后我可以将其转发给所有注册的客户端.SQL Notification Services 或 Service Broker 会在表更改(插入/更新/删除)时发出通知吗?任何建议都会有所帮助.
Can anyone suggest a way to notify my middle tier service about the database change which then I can relay it to all registered client. Will SQL Notification Services or Service Broker notify when the table is changed (inserted/updated/deleted)? Any suggestions will be helpful.
推荐答案
查询通知正是这样做的.当服务器上的数据发生更改时,您将收到通知,您必须再次查询数据以刷新 UI.一个简单的实现是使用 LinqToCache 并添加一个 OnInvalidated
CachedQueryOptions 对象的处理程序.
Query Notifications does exactly this. You will get a notification when data has changed on the server, you have to query the data again to refresh your UI. A simple implementation would be to use LinqToCache and add an OnInvalidated
handler to the CachedQueryOptions object.
这篇关于数据库变更通知的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!