public void AttachElements()
{
foreach (Descriptor descriptor in Descriptors.Values)
{
if (Relationships.ContainsKey(descriptor.RelationshipUid))
{
Relationship relationship = Relationships[descriptor.RelationshipUid];
relationship.AddNode(descriptor);
}
}
foreach (Metadata metadata in Metadata.Values)
{
MetadataContext metadataContext = new MetadataContext(metadata);
if (metadataContext.GetContextType() == MetadataContextType.Node && Nodes.ContainsKey(metadata.NodeUid.Value))
{
Node node = Nodes[metadata.NodeUid.Value];
node.Metadata.Add(metadataContext, metadata);
}
else if (metadataContext.GetContextType() == MetadataContextType.Relationship && Relationships.ContainsKey(metadata.RelationshipUid.Value))
{
Relationship relationship = Relationships[metadata.RelationshipUid.Value];
relationship.Metadata.Add(metadataContext, metadata);
}
}
}