开发者

A few questions about SqlDependency/SqlCacheDependency

开发者 https://www.devze.com 2023-03-19 13:39 出处:网络
I have a few questions that i would like to clear Can u use SqlDependency or SqlCacheDependency to find out which particular data item has changed in the database?

I have a few questions that i would like to clear

  1. Can u use SqlDependency or SqlCacheDependency to find out which particular data item has changed in the database?

  2. Right now , i am using SqlCacheDependency by having a background thread that periodically checks the value of cache. If the cache is null, it reads data from database and inserts it into the cache. Is there a better way to do it 开发者_StackOverflow中文版rather than using a background thread for polling the cache periodically?

  3. If i understand correctly, SqlDependency works by having a dependency for a command. Once a notification occurs, an onchangeevent is fired . In the event handler , you unregister the dependency and create a new one . Is there any other purpose for this Onchangeevent handler? For instance, can i find out which item has changed, push the new data to clients from here,etc ?

  4. With SqlCacheDependency, i believe i have to poll the cache periodically. With sqlDependency, i need not poll at all. Is this true ?

Thanks in advance

0

精彩评论

暂无评论...
验证码 换一张
取 消