Get Started!

Canvas DataItem

DataItem is the base class for Canvas Data Types, used by the built-in DataServer tools, backed by MongoDB.

The Base Class DataItem

The class DataItem has a number of default fields :

  • nId - The internal id used by Canvas for uniquily identifying a specific Item.

  • cExist - A flag used to mark an item as exisitng or deleted.
    Normally this value is A for an Existing Data Item or Z for a Deleted Data Item. Being a string you can use other values to allow for archiving etc.

  • eDateTime - A DateTime value tracking the last time this item was updated / written to the DataBase.

  • MongoId - An MongoDB.Bson.ObjectId for MongoDB insertion

  • oRelations - Used internally when items are related via DataItemRef or DataItemsRef propertiees to track the reverse association of the relationship.

There are also a number of methods :

  • ToJSON - Returns a json Serialized string of the DataItem.

  • ToXML - Returns an xml Serialized string of the DataItem.

  • RelatedTo<T>(string uniquieRef = "") - Returns a List<T> of DateItems that are associated with this item, which are of type T.

    Optionally, the uniquieRef param allow's you to scope the result by only returning items which were attached with the given identifier.

    This is covered in greater detail in DataItemRef and DataItemsRef.

Creating a New DataItem / DateType

Dynamic Assemblies allow you to create new Data Types. The tools automatically generate the supporting classes to manage the database suchas Insert, Update, Delete Search etc.

To see how to create a new DataType see the .dash reference.