Telerik OpenAccess Classic

Telerik OpenAccess ORM Send comments on this topic.
The Object Container
Programmer's Guide > OpenAccess ORM Classic (Old API) > Programming With OpenAccess > The OpenAccess ORM Disconnected API > The Object Container

Glossary Item Box

This documentation article is a legacy resource describing the functionality of the deprecated OpenAccess Classic only. The contemporary documentation of Telerik OpenAccess ORM is available here.

The object container fills the role of the object scope when using the OpenAccess ORM disconnected API. Objects are copied from an object scope to the object container. After adding the objects to the container, you can perform operations on the objects in the container without an object scope and therefore without a direct database connection. The object container is then completely responsible for change tracking. Objects can be modified, added, and deleted just like with the object scope. At a later time, the changes made within the context of the container are "played back" to the database in a single step. This step can be done with any object scope.

The ObjectContainer only handles/copies persistent fields of persistent classes, since currently, only those fields have a description.

The object container is implemented by the ObjectContainer class. To construct an instance of ObjectContainer, you simply call the class constructor:

C# Copy Code
ObjectContainer container = new ObjectContainer();
VB .NET Copy Code
Dim container As New ObjectContainer()

Once you have your new ObjectContainer object you can copy the objects you want to work with from a database to the container. The container can only contain objects from a single database but you can copy objects to the container at any time from different object scopes. The reason for this limitation is that the identity of the copied instances must be maintained. You can modify the objects in the container, add new objects, and remove objects. When you are ready, the container contents are "played back" to the database. OpenAccess ORM provides an optimistic concurrency control mechanism for the container.

The complete object container can be serialized to export the content into a file or to send it over a network connection to another application. This byte- or XML-stream can be used to fill a new container object. All object states are serialized with the container—nothing gets lost.