Nevron Open Vision Documentation
Child Slots

Child Slots Overview

The child slots of a node are represented by singleton instances of the NChild class. These instances are internally created when you call the AddChild method of the schema that is associated with the node to which you want to add the child slot, in the specific node static constructor. The schema must be previously marked as a container node. The returned NChild instances need to be stored as public static readonly fields, that follow the ChildName + "Child" naming convention.

In the DOM child slots serve for the following purposes:

Creating Child Slots

The following code sample demonstrates how to create a container node with two child slots:

My First Container Node
Copy Code
public class MyContainerNode : NNode
 public MyContainerNode() 
 static MyContainerNode() 
  MyContainerNodeSchema = NSchema.Create(typeof(MyNode), NNode.NNodeSchema);

  Child1Child = MyContainerNodeSchema.AddChild("Child1", typeof(NNode));
  Child2Child = MyContainerNodeSchema.AddChild("Child2", typeof(NNode));

 public NNode Child1 
  get  {   return GetChild(Child1Child);  }
  set  {   SetChild(Child1Child, value);  }

 public NNode Child2 
  get  {   return GetChild(Child2Child);  }
  set  {   SetChild(Child2Child, value);  }

 public static readonly NSchema MyContainerNodeSchema;
 public static readonly NChild Child1Child;
 public static readonly NChild Child2Child;
Child Slots Metadata

The metadata available for each child slot includes the child slot flags and meta units. The following table summarizes the flags API of NChild

Getter and Setter Description

Flags applicable to all nodes

bool GetSerializable(NSchema schema)
void SetSerializable(NSchema schema, bool value)

Gets or sets whether the node exposed by the child slot needs to be serialized. By default true.

bool GetNullable(NSchema schema)
void SetNullable(NSchema schema, bool value)

Gets or sets whether the child slot can be null. By default true.

bool GetDeeplyCloneable(NSchema schema)
void SetDeeplyCloneable(NSchema schema, bool value)

Gets or sets whether the node exposed by the child slot needs to be deeply cloned when the node is deeply cloned. By default true.

bool GetCreateOnDemand(NSchema schema)
void SetCreateOnDemand(NSchema schema, bool value)

Gets or sets whether the node exposed by the child slot needs to be automatically created when the user tries to acces the child slot for the first type. By default false.

Flags applicable to NDocumentNode derivates

bool GetRecordable(NSchema schema)
void SetRecordable(NSchema schema, bool value)

Gets or sets whether changes in node hiearchy exposed by the child slots is recorded by history. By default true.

Custom Flags - not used by NOV

bool GetCustomX(NSchema schema)
void SetCustomX(NSchema schema, bool value)
where X in [1: 5
] range

A set of 5 custom flags you can use as you wish.

Each specific child slot flag and each specific meta unit can be overriden for a specific schema, that needs to be derived from the child slot owner schema (the schema that originally declared the child slot).

Meta units are the DOM equivalent of CLR attributes. You can associate meta units with each property instance via the SetMetaUnit method. You can use the GetMetaUnit method to obtain a previously set meta unit by its key.

See Meta Units for more info.

Send Feedback