Sparx Systems Forum

Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: Rich Anderson on July 23, 2019, 12:02:09 pm

Title: Get new Element instance in memory without persisting to the database?
Post by: Rich Anderson on July 23, 2019, 12:02:09 pm
Is there any way to get a new instance of an Element in memory without having to use an AddNew method on a Package or Element which immediately persists the new Element to the database?   What I would like to do is create an Element in memory, set properties and then later optionally add it to a Package Elements collection if it passes all the tests I have defined for it.  When I try...

Code: [Select]
Dim myElement as New Element()
myElement.Name = "Joe"

The first statement fails and I understand why it does.  I suppose the alternative is to create an element in temporary package and then delete it, but maybe there is a better way?   
Title: Re: Get new Element instance in memory without persisting to the database?
Post by: Geert Bellekens on July 23, 2019, 02:32:18 pm
No, there is no other way. The only way to create a new thing in EA is to add it to the collection of its parent.

Geert