更新时间:2023-02-13 18:27:37
SqlNotificationRequest
在内部使用SqlDependency
订阅查询事件。我会在SqlDependency
上使用SqlNotificationRequest
,因为大部分布线已经完成,这意味着可以更轻松地使用通知。从技术上讲,因为一个在内部使用另一个,两者没有区别,只有一个有很多设置工作。
SqlNotificationRequest
usesSqlDependency
internally to subscribe to query events. I would useSqlNotificationRequest
overSqlDependency
because most of the wiring is already done and it is meant to make using notifications easier. Technically because one uses the other internally, there is no difference in the two, just one has a lot of the setup work done.
In case of SQLDependency/SQLNotificationRequest you require separate queue per process. If your different processes listen on the same queue then event notification is not guaranteed. But this is how it is right now.