This can become a relatively complex converstation for an "auto-requery." If you are using SQL Server, then you can use Query Notification Services to have events raised when the server data changes....however, this needs to be used with caution as there are some shortcomings that can cause a number of issues.
Let me share a suggestion with you that we have used in the past which works very well. We use a row version field for all of our concurrency checking. So every table in our databases will have an integer field that is used as a Row Version column. The help docs will show how to setup the BO settings for this.
Once this is done, it makes if very easy to perform a simple scalar query to basically perform a checksum or a SUM comparison between the data that you have on your server and what is in your BOs.
For example, I may have a query that looks like this to retrieve all of my records:
SELECT * FROM MyTable
So I now want to setup a threaded timer to callback periodically to see if anything has changed:
private System.Threading.Timer queryTimer = new System.Threading.Timer(new System.Threading.TimerCallback(QueryCacheUpdate),
null,
new TimeSpan(0,1,0),
new TimeSpan(0,1,0));
private static void QueryCacheUpdate(object state)
{
//-- Establish Locals
long checkSum = MyBo.GetRowVersionSum();
long localSum = 0;
//-- Compare the checkSum with the version SUM within the current BO.
localSum = MyBO.CurrentDataTable.Compute(...);
if(checkSum != localSum)
{
//-- Reload your cache here
}
}
This should at least give you an idea of how to set something like this up. Hope it helps.