Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Here's how you use ReferenceDataManager
ObjectId hierarchyId;
var builder = new ChangeSetBuilder(objectFacade, null);
var hierarchy = builder.CreateHierarchy();
hierarchyId = hierarchy.Id;
var parentUnit = builder.CreateUnit("Parent", new Address("Lubicz", "23", "Krakow", "PL"));
var childUnit = builder.CreateUnit("Child", null);
builder.SetHierarchyRoot(hierarchy, parentUnit);
builder.SetParent(hierarchy, childUnit, parentUnit);
var view = objectFacade.GetSnapshot(builder.PendingChanges);
var hierarchy = view.GetById<Hierarchy>(hierarchyId);
var rootUnit = hierarchy.RootUnit;
var childUnits = hierarchy.RootUnit.GetChildrenWithin(hierarchy);
var firstChildUnit = childUnits.First();
Assert.AreEqual("Parent", rootUnit.Name);
Assert.AreEqual(new Address("Lubicz", "23", "Krakow", "PL"), rootUnit.Address);
Assert.AreEqual("Child", firstChildUnit.Name);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment