Book a Demo

Author Topic: Using the entities method clone()  (Read 2994 times)

Ben_68

  • EA Novice
  • *
  • Posts: 3
  • Karma: +0/-0
    • View Profile
Using the entities method clone()
« on: June 29, 2019, 01:27:54 am »
Hi everyone,

This is my first post in this forum, so greetings to all...

Did someone know how to use the entities method clone()?  If I write something like this, "elementToClone.Clone()" alway return null (obviously, "elementToClone" is not null itself and contain an element after it's assignation) :


EA.Element newElement;
EA.Element elementToClone;

elementToClone = Repository.GetElementByID(anElementID);
newElement = elementToClone.Clone();



Maybe I'm not using this method correctly?
NB, I'll be in vacation soon, so don't worry if you post an answer and I don't reply fast...

Thank you!

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Using the entities method clone()
« Reply #1 on: June 29, 2019, 02:14:16 am »
Not sure, I've never really used that method yet (it's fairly recent IIRC)

I did use package.Clone in the past, and that worked just fine.

According to the documentation that code should work.

Geert

Ben_68

  • EA Novice
  • *
  • Posts: 3
  • Karma: +0/-0
    • View Profile
Re: Using the entities method clone()
« Reply #2 on: June 29, 2019, 03:10:00 am »
Hi Geert,

While trying to make it work, I have also tested this with package.clone() method, with the same result; package.clone() return null.  Just figure out the same code sample with a package instead of an element.  That's why I think that maybe it should no be written this way...

Thank you,

Ben_68

  • EA Novice
  • *
  • Posts: 3
  • Karma: +0/-0
    • View Profile
Re: Using the entities method clone()
« Reply #3 on: June 29, 2019, 03:11:57 am »
BTW, we use EA 14, so it's not a matter of EA version...

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Using the entities method clone()
« Reply #4 on: June 29, 2019, 08:29:33 am »
What's the reason for creating clones in a model? That's always making me shiver one starts doing that. A model is about abstraction. Not about creating clones.

q.
« Last Edit: June 29, 2019, 06:29:59 pm by qwerty »

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Using the entities method clone()
« Reply #5 on: June 29, 2019, 03:27:01 pm »
That's weird. Have you reported it to sparx support?

Geert