Project DescriptionThe 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 Scenariothe flow:
- Load an entity.
- 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).
- The client modifies the entity.
- The client sends the entity back to the server.
- 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 FrameworkThe 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.
LearnDetailed description can be found at
Offir Shvartz's Blog