Entity Enhancements
Widget Connector | ||||||
---|---|---|---|---|---|---|
|
Detach
Inability to detach is what coders have complained about most when working with LINQ to SQL. Well, complain no more. PLINQO makes it easy to work with entities independent from a datacontext and attach to another when you are ready to save your changes. The following code is now possible thanks to PLINQO.
...
Read more about how PLINQO implemented detach.
Clone
PLINQO takes advantage of the DataContractSerializer in WCF to provide a quality cloning solution for all entity objects. Simply call the Clone method on any entity generated by PLINQO and what you get is an object copied to its own memory location. Below is a quick sample of the clone method in action. A user object is retrieved from the database, cloned, one property is changed, a new user is saved to the database.
using (var context = new TrackerDataContext()) { var u = context.Manager.User.GetByKey(1); User clonedUser = u.Clone(); clonedUser.Id = 0; context.User.InsertOnSubmit(clonedUser); context.SubmitChanges(); }
Serialization
Serialization of entities has had developers running in circles from the early days of LINQ to SQL until now. PLINQO eliminates this frustration by eliminating the possibility of circular references and taking advantage of WCF datacontract serialization. Here is a sample of serializing an object using PLINQO.
...
task = Task.FromXml(xml); task = Task.FromBinary(b);
Next: Enum Generation