How to clone one object?

Discussion of open issues, suggestions and bugs regarding Entity Framework support in ADO.NET Data providers
Post Reply
Posts: 10
Joined: Tue 18 Sep 2012 07:55

How to clone one object?

Post by software931 » Wed 30 Jan 2013 09:51

I have for example an Entity object CAR.

The key is CAR.PlateNumber

Now I want clone this object and all attributes, except the PlateNumber.
But I don't like to assign all attributes separately. Like
NewCar.color = oldCar.color, .....

Is there a Clone function available?

Site Admin
Posts: 8247
Joined: Thu 14 Aug 2008 12:44

Re: How to clone one object?

Post by Shalex » Fri 01 Feb 2013 12:52

Please open your *.edml model, navigate to VS > Tools > Entity Developer > Model Explorer, select your template and set its Implement Cloneable property to True. As a result, each entity class will implement the ICloneable interface.

Post Reply