New Posts New Posts RSS Feed: Cloning entities, is there anything built in?
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

Cloning entities, is there anything built in?

 Post Reply Post Reply
Author
katit View Drop Down
Senior Member
Senior Member


Joined: 09-Sep-2011
Posts: 146
Post Options Post Options   Quote katit Quote  Post ReplyReply Direct Link To This Post Topic: Cloning entities, is there anything built in?
    Posted: 07-Jan-2013 at 10:54am
Great! Works as expected.
Back to Top
kimj View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 09-May-2007
Posts: 1391
Post Options Post Options   Quote kimj Quote  Post ReplyReply Direct Link To This Post Posted: 07-Jan-2013 at 10:36am
Oh sorry, yes, System.ICloneable is a .NET only interface.   In SL applications you can use IdeaBlade.Core.ICloneable.
Back to Top
katit View Drop Down
Senior Member
Senior Member


Joined: 09-Sep-2011
Posts: 146
Post Options Post Options   Quote katit Quote  Post ReplyReply Direct Link To This Post Posted: 07-Jan-2013 at 10:00am
Thank you for reply!
 
I tried to do it with ICloneable but it won't work. Is it SIlverlight issue?
I get error Error 6 'System.ICloneable' is inaccessible due to its protection level 
Back to Top
kimj View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 09-May-2007
Posts: 1391
Post Options Post Options   Quote kimj Quote  Post ReplyReply Direct Link To This Post Posted: 06-Jan-2013 at 2:36pm
Yes, all DevForce entities implement ICloneable via an explicit interface implementation.   You can cast to ICloneable and call Clone:
  Customer customerCopy = ((ICloneable)aCustomer).Clone() as Customer;
 
The returned entity is in a Detached entity state.
 
More information on working with entities is in the DevForce Resource Center - http://drc.ideablade.com/xwiki/bin/view/Documentation/create-modify-delete.
Back to Top
katit View Drop Down
Senior Member
Senior Member


Joined: 09-Sep-2011
Posts: 146
Post Options Post Options   Quote katit Quote  Post ReplyReply Direct Link To This Post Posted: 06-Jan-2013 at 11:57am
Let's say I want to create detached entity instance with properties matching existing entity. Classic example - in data entry details I want to create copy of the order line.
 
How do I do this? Currently I'm manually copying each property value. Is there anything built-in for this?
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down