Project Description
The SelfTrakingDTO Framework addresses the disconected scenario with the use of DTO objects that can track their own state and then apply the modifcations on the original object.

The Disconnected Scenario

the flow:
  1. Load an entity.
  2. Send it to the client – N-Tier maybe by WCF. (the client doesn’t hold the ORM context so the entity is in a disconnected state).
  3. The client modifies the entity.
  4. The client sends the entity back to the server.
  5. The server synchronizes the modifications with the database – this is the hard part since the server doesn’t know what modifications where made, if any.

The Self Tracking DTO Framework

The framework enables the scenario above by using special objects – self tracking DTOs. The server works with the POCOs as usual but when it needs to send an entity to the client it uses a different object (a DTO).It implements the same interface but in addition provide special functionality:
  • It Populates itself by a given server entity.
  • Creates a new server side entity that contains its own value – by the common interface.
  • Applies the modification made on it on a given server side object.
  • Bonus: INotifyPropertyChange – implemented by the DTO implements so if you use WPF you get it out of the box.

Detailed description can be found at Offir Shvartz's Blog

Last edited Dec 7, 2009 at 2:56 PM by offirsh, version 4