Entity/Collection hierachy

Posts   
 
    
simmotech
User
Posts: 1024
Joined: 01-Feb-2006
# Posted on: 06-Mar-2008 06:54:53   

We are using Adapter entities for client-server via a remoting service interface.

We might return an entity collection as a root or just a single entity but there is likely to be a lots of subentities/child collections from prefetch paths which may be one or several levels deep.

We have two immediate requirements: 1) We need to know when anything in the entire tree has been modified (even if just to put an asterisk on the tab title and/or enable a save button). Once a change has been made, we don't necessarily need to keep watching for changes - once dirty, always dirty.

2) We need to monitor when child entities which may at any arbitrary depth in the tree have been deleted. This seems to require creating and a RemoveEntitiesTracker on every collection witihin the tree. Maybe its possible to have one common tracker and inject it into each member collection?

Ultimately, we just want to pass back the minumum necessary changes back to the server for persistence, probably via a UnitOfWork2. Once saved, we will use the same Fetch service code to bring back the whole tree again.

I have (albeit briefly) thought about the following methods: 1) Custom Factories: because the entities are initially created on the server, we can't use client-side factories. 2) Custom collections: Again, they are already created on the server-side and the entity member collections don't have a hook to enable custom collections (without changing templates?) 3) Contexts: Not really designed for this purpose and so not readily extensible. Would have been useful since all entities could be added to the context once retrieved from the server and then maintained from that point on. 4) Auditing: This seems to be the favourite (provided there is no need for access to a DataAccessAdapter and/or transactions neither of which will be available on the client side) and I'll look further into this. We don't have requirements to write database audit records for now.

What are other folks doing to achieve the above currently?

Cheers Simon

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 06-Mar-2008 09:53:13   

Ultimately, we just want to pass back the minumum necessary changes back to the server for persistence, probably via a UnitOfWork2. Once saved, we will use the same Fetch service code to bring back the whole tree again.

At client side you should build a unitOfWork, and then add to it every entity to be deleted and each modified entity, one at a time, instead of collecting and tracking changes when submitting the changes.