My new application has a class named "PlannedCall". When the user logs in they see a list of planned calls that are
B: Not already actioned
C: Assigned to the current user, or not assigned to anyone
D: EarliestCallTime <= Today + 1
As time goes on there will be a lot of instances of this class in my DB, so obviously I want to use the OclPSHandle to select my objects otherwise I will end up with a whole load of objects in memory that I do not need. However, when another user actions the planned call the Actioned property becomes true. If I use an ExpressionHandle then this planned call would disappear from the presented list, but with OclPSHandle it will not. This is where the new feature comes in!
When you call PersistenceService.RetrieveChanges a collection of DBChange will be sent to the client from the server. The EcoSpace will inspect this list and create an IChange each time the DBChange refers to an object instance loaded into the EcoSpace cache.
In the past the DBChanges that do not apply were discarded, but now you can get hold of them. Take a look at this:
//Do what you normally do with the IChange list here!
//Now check if there are relevant changes to objects we have not loaded
int plannedCallClassId =
foreach(DBChange currentChange in ignoredChanges)
if (currentChange.ObjectId.ClassId = plannedCallClassId)
SelectPlanendCalls will just execute an OclPsHandle...
sqlPlannedCalls.Expression = "PlannedCall.allInstances->select(...whatever...)";
This will only load objects that meet the correct criteria.
Finally, my expression handle can work on PlannedCall.allLoadedObjects instead of PlannedCall.allInstances - something like this
->select( (assignedTo->isEmpty) or (assignedTo = var_CurrentUser) )
->select(earliestCallTime <= DateTime.Now.AddDays(1))
So now I have the benefit of being able to limit which objects I use by utilising the OclPsHandle, but also the benefit of the list being subscribed to so that changes to my local cache will add/remove rows in the grid displaying the planned calls + the list is updated if someone else updates a planned call.
I've just tested it in my application. I'm so pleased that I felt compelled to tell the world :-)