Auto-generated classes derived from a DataContext are not intended for long-lived objects. In the vast majority of cases of use, you must create an instance, read the data that you need, and / or make the necessary changes, send, and then forget about the object. It does not directly represent a database connection - creating DataContext instances does not necessarily open multiple database connections.
The consequence of this is that you have to keep in mind that your data is always out of date, especially if a separate process can access the same database. Once you receive the data, another process can immediately update this data. The only way to guarantee volatility is to maintain an open transaction, and I am sure you know the consequences of continuing the transaction for too long is that another process will detect that the database is very unresponsive, as if it were very slow - so use a transaction only for the processing phase, which includes almost only access to the database, which should be atomic.
Thus, in your particular case, the only way to find out if there are any new actions that need to be done is to continue to query the database. You do not need to continue to receive data and compare them using Equals; you can just get all the data that you already have, that is, tell the database about the return of only new rows. Since I do not know your database schema, I am doing everything here, but I am sure this will give you an idea:
var newActions = db.ScheduledActions.Where(act => !oldActions.Contains(act)).ToList(); if (newActions.Any()) {
Edit: Now I understand that you need to check not only new actions, but also changes to existing actions. Personally, how I implement this is to have a date / time field in the ScheduledActions table that indicates the time of the last change. Then you don't need a custom comparison mapper, but instead, you can use this to find out what has changed. Unfortunately, this means that you need to get all the actions, even those that have been changed. In the following example, I assume that ScheduledActions are identified by a primary key of type string ; change this to int if you use number keys:
Dictionary<string, ScheduledAction> oldActions = new ...; [...] var allActions = db.Actions.ToList(); var changedActions = allActions.Where(act => !oldActions.ContainsKey(act.Id) || oldActions[act.Id].LastChanged < act.LastChanged).ToList(); if (changedActions.Any()) {