RetrieveChanges(out ignoredChanges)

Here’s another quick blog about a new ECO IV feature. I asked for this during development because I had a particular problem I had to solve.

My new application has a class named “PlannedCall”. When the user logs in they see a list of planned calls that are
A: Active
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:

DBChangeCollection ignoredChanges;

//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(not actioned)
->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 🙂

6 thoughts on “RetrieveChanges(out ignoredChanges)

  1. Hi Peter,

    Thanks for the answer on ECO with VS.

    You said
    I am using ECO IV in VS2005 because I have access to stuff that has not yet been released.

    Could you possibly tell us when the likely release date of ECO for VS2005 would be…

  2. I am using ECO IV in VS2005 because I have access to stuff that has not yet been released. I’m using EcoModeler for ECO IV, which supports the new code-gen format (such as generics).


  3. Can you use ECOMODELER with VS2005 and still use all the ECO Services, State Machine

    What do you need for deployment

    OR would ECO be available as a plug in for VS

  4. Peter

    I notice this ECOIV example is C#.
    Will C# be the dominate language for EcoIV?

Leave a Reply

Your email address will not be published. Required fields are marked *