Telerik OpenAccess Classic

Telerik OpenAccess ORM Send comments on this topic.
Generic collections/dictionaries
Programmer's Guide > OpenAccess ORM Classic (Old API) > Programming With OpenAccess > The .NET Data Model > Generic collections/dictionaries

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.

Generic collections/dictionaries

.NET 2.0 defines a new set of classes and interfaces for generic collections and generic dictionaries. These are contained in the namespace System.Collections.Generic.

OpenAccess ORM supports the following interfaces as field-types of persistent classes:

Copy Code
System.Collections.Generic.ICollection<>
System.Collections.Generic.IList<>
System.Collections.Generic.IDictionary<>

With these classes the old [OpenAccess.ItemType] attribute is not needed (and therefore it is not supported), as OpenAccess ORM can derive the type information of the element type (or key and value type) directly from the generic field declaration.

All the generic collection interfaces from the System.Collections.Generic namespace are supported by OpenAccess ORM, however classes from this namespace are not supported. In case of non-generic collections (in the System.Collection namespace), OpenAccess ORM supports both interfaces and classes.

The reason for this is, that to provide change tracking and lazy loading OpenAccess ORM needs to replace collection classes at runtime (e.g. TrackedArrayList instead of ArrayList). The tracked collections are derived from the original collections classes, and provide the needed additional services.

Unlike the old non-generic collections, from the System.Collections namespace, the new generic collection and dictionary implementations, does not allow to derive our internal implementation classes from them. This is due to the fact that most methods are not virtual. The internal implementation classes are needed to provide the services of lazy loading and automatic change tracking.

Due to this reason, only interfaces from the System.Collections.Generic namespace are supported , specifically these are: ICollection<>, IList<> and IDictionary<>