Created
January 15, 2012 21:04
-
-
Save SzymonPobiega/1617321 to your computer and use it in GitHub Desktop.
Here's how you use ReferenceDataManager
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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