ice.NET Key Concepts: Objects

Objects are the most important elements of ice.NET. All information that is managed by ice.NET is organized in objects (or object structures). Objects share a set of common characteristics:

  • Every object conforms to exactly one object type at a specific point of time. (The type of an object might be changed, but an object cannot be of two or more types.)
  • Every object is identified by its object ID. This ID does not change and exists until the object is deleted. The ID does not change even if the object's type is changed. The ID is unique within the scope of the current system context (i.e. normally within a database or an XML document).
  • Every object has a name and a description.
  • Furthermore objects can have attributes. The attribute structure of an object is determined by it's object type.
  • Objects can be part of a graph-style network structure. The connections between the objects are represented by relationships.

Example

This example shows how to create objects.

IObjType pObjType = Repository.GetObjTypeByName("PDTec.ICR.SportsCar");
IFolder  pFolder  = Repository.GetFolderByKey("ICR.Data.Cars");

Repository.ExecuteTransaction(delegate()
{
    // Create an object...
    IObject pNewObject = Repository.pObjType.CreateObject(pFolder, "Porsche 911", "");

    // ...[do something with the new object]...

});     

This example shows how to retrieve objects.

// Retrieve an object (identified by an object ID)...
IObject pObject = Repository.GetObject(objectId);

// ...[do something with the object]...

Important notice: These examples use the low-level ice.NET API. Implementing Business Objects and using the Business Objects Builder (icebob.exe) enables more type-safe access to attributes, relationships and domain-specific functionality.