SqlDependency finding the source of the OnChange event
I'm trying to find the best way to keep my clients updated as fast as possible and with as little bandwidth usage as possible, when there is a change on my Sql Server 2008 R2 DB.
I have managed to get the SqlDependency OnChange event working, this really hel开发者_运维知识库ps with notifying when there is a change on the DB, but does little in keeping the Bandwidth usage at a minimum.
The System I'm developing is going to have over 100.000 Products, and its just a massive waste, doing a new query every time, one of the products get updates ex. Stock info changes.
I'm looking for a way to find what product resulted in the OnChange event. So that I only needs to query for 1 Product instead of 100.000 Products.
Why not get only updated data when OnChange event is fired. Store last update time in your object and query for products updated after last update time. Then either update or add product to your products list based on identity exist in ur collection
精彩评论