NShape Concepts
Implementing Entities

<< Click to Display Table of Contents >>

Navigation:  Concepts > Persistency >

NShape Concepts
Implementing Entities

Previous pageReturn to chapter overviewNext page

Implementing the IEntity interface is a rather easy task. To sum it up, you have to specify the persistable properties and call Read/Write methods for each of these properties. GetPropertyDefinitions has to return all properties- and inner object definitions that are loaded and stored in the implementing class.

 

First of all, the implementing class has to provide a list of property- and inner object definitions by implementing the static method IEntity.GetPropertyDefinitions.

Property definitions are objects of type EntityFieldDefinition define a name and a CLR data type for a property of the object to be persisted.
InnerObjects are objects/structures consisting of multiple properties or lists of such objects/structures. Due to this fact, the inner object definitions of type EntityInnerObjectsDefinition consist of a name and a list of property definitions.
A good example for inner objects are vertices of linear shapes that consist of an index value, a ControlPointId value and two coordinate values.

 

The rest of the implementation is straightforward. Just implement all methods of the interface or the methods provided by the base class, preferably as explicit implementation. Details on how to implement the load and save methods can be found in the chapters "Implementing the Load Method" / "Implementing the Save Method" in "Adding Persistency support".