Sparx Systems Forum
Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: Stenvang on April 08, 2015, 11:01:01 pm
-
I've got the following code which creates a new EA Model and a subpackage to that model. However it seems like the subpackage is only updated/created "visually" - by that I mean that I can see it in EA but if I try to get the packages of my new root it returns 0 which should be 1.
var root = eaRepo.Models.AddNew("A New Root", "");
root.Update ();
eaRepo.Models.Refresh();
Package newPackage = root.Packages.AddNew("New Package", "Package");
newPackage.Update();
eaRepo.Models.Refresh();
var packages = root.Packages.Count; //Returns 0 but I just created one
Any suggestions on why this doesn't work?
-
If you print eaRepo.Models.count rather than root.Packages.Count you should be fine. Alternatively refresh root.packages instead.
q.