Telerik OpenAccess Classic

Telerik OpenAccess ORM Send comments on this topic.
Object Resolution
Programmer's Guide > OpenAccess ORM Classic (Old API) > Programming With OpenAccess > Query a Data Model > Object Resolution

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.

In your persistence capable classes, all fields of persistence capable class types (other than value types) are references to other objects in the database. When you read an object from the database into an object scope, all default fetch group fields are loaded. Fields that are not in the default fetch group are loaded on demand, i.e., when they are accessed for the first time. By default, references to other persistent classes and also collections and arrays of persistent classes are not in the default fetch group (Refer to DefaultFetchGroup Attribute and Default FetchGroup for more information about the default fetch group).

Loading the referenced object data into memory is referred to as resolving the reference. OpenAccess ORM defers loading referenced objects. For example, if you retrieve an object of type Product into your application, the fields of base types (such as int or string) in your Product instance and which, are part of the default fetch group are retrieved directly. This means that you can, for example, get the product number or name immediately. The Product object also has a supplier field that is a reference to a Supplier object. If you are reading the Product object merely to determine its name, you do not need to have the supplier information in memory as well. However, if you do need to access the supplier, OpenAccess ORM resolves the Supplier object by loading the data on demand. This happens automatically when the supplier field is accessed for the first time.

Deferred resolution saves time—only the immediately necessary information is transferred from the database. Deferred resolution can also save memory. Consider the Supplier class above. If the supplier has a collection of employees, without deferred resolution, memory for the Employee objects would need to be allocated as well. All just to read the product name!

The IObjectScope interface provides a special method, Retrieve(), which you can use to force object resolution by immediately retrieving the object content:

C# Copy Code
IObjectScope scope =ObjectScopeProvider1.GetNewObjectScope();
            Product result = (from c in scope.Extent<Product>() select c).First();
VB.NET Copy Code
Dim scope As IObjectScope = ObjectScopeProvider1.GetNewObjectScope()
Dim result As Product = (From c In scope.Extent(Of Product)() _
 Select c).First()

You can also retrieve all the elements of a collection by passing the collection to the Retrieve() method. Object resolution is also forced while using prefetch values.