C#/SQL Database listener

后端 未结 6 1096
挽巷
挽巷 2020-12-10 13:14

I have a requirement to monitor the Database rows continuously to check for the Changes(updates). If there are some changes or updates from the other sources the Event shoul

6条回答
  •  心在旅途
    2020-12-10 13:22

    I think there's some great ideas here; from the scalability perspective I'd say that externalizing the check (e.g. Paul Sasik's answer) is probably the best one so far (+1 to him).

    If, for some reason, you don't want to externalize the check, then another option would be to use the HttpCache to store a watcher and a callback.

    In short, when you put the record in the DB that you want to watch, you also add it to the cache (using the .Add method) and set a SqlCacheDependency on it, and a callback to whatever logic you want to call when the dependency is invoked and the item is ejected from the cache.

提交回复
热议问题