Persistence

Each entity is able to persist itself to a binary blob using the IPersist, IAgPersistSafeArray, and IAgEntityMerge interfaces; this is useful anytime you need to persist an entity over some medium, be it storage on a hard disk or for sending data over the network. The persistence is used within the framework itself for a number of things, including logging and archiving.

It is important to note that if a non-basic type object is added to the entity metadata, it must also implement IPersist, IAgPersistSafearray and IAgEntityMerge. Any attempt to use the persistence interface on an object with metadata that does not implement these interfaces will fail.

//Write out PointEntity1 and the read it back into PointEntity2
object Blob = PointEntity1.WriteSafeArray();
PointEntity2.ReadSafeArray(Blob);

//PointEntity2 into PointEntity1 so they have the same data
PointEntity2.MetaData.SetMetaData("Test", 1);
PointEntity1.Merge(PointEntity2);

For other fully working documented examples of using entity objects, see the ReferenceEntityProvider and ReferenceClientApplication projects located in the Help/RT3/Samples directory in your STK install location.

STK 11.2.1 Programming Interface