简体   繁体   中英

Notify clients of table records change

I have a project that doesn't utilize any ORM . It's a Webforms project, and most of the business logic resides in stored procedures on a database side.

Here's how workflow works:
User goes to a page ->
selects necessary parameters ->
retrieves dataset from stored procedure. ->
Then we store that dataset in ViewState for faster access, meaning that records can become stale after another user edits them. If we do not store those records in a Viewstate, then application becomes really slow to use.

Question: What is the best way to update state of records automatically, and what is the correct caching approach? How to see if record is current? Do you think that SignalR can help with that?

It does not matter what caching model you use, or what libraries, if your data is slow to populate you will still experience a significant delay when trying to verify the state of the cached DataSet. You could use SignalR to manage a connection with the server, but this still means that your user could potentially be working with an out of date DataSet with all of the consequences while the 'currentness' of the cached data is determined.

I'm with @MichaelPerrenoud, and would look closely at the execution plan for the stored procedure that return the DataSet. Compare the execution times between your application and running the procedure in a query window - it may be a parameter sniffing issue that is causing an inefficient execution plan to be utilised.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM