A few questions about SqlDependency/SqlCacheDependency
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?
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?
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 ?
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
精彩评论