T
Chili.Opf3 Send comments on this topic.
Generic ObjectHolder Class
See Also  Members   Example 
Chili.Opf3.Relations Namespace : Generic ObjectHolder Class




Holds one single object that is connected with the parent object.

Object Model




Syntax

Visual Basic (Declaration) 
Public NotInheritable Class ObjectHolder(Of T) 
   Inherits ObjectHolderBase
Visual Basic (Usage)Copy Code
Dim instance As ObjectHolder(Of T)
C# 
public sealed class ObjectHolder<T> : ObjectHolderBase 
Managed Extensions for C++ 
public __gc __sealed class ObjectHolder<T> : public ObjectHolderBase 
C++/CLI 
generic<typename T>
public ref class ObjectHolder sealed : public ObjectHolderBase 

Type Parameters

T

Example

The following example shows how to use the ObjectHolder in your persistent objects. In the example each Call has one associated User.
C#Copy Code
            [Persistent("CALLS", PoolSize = 20)] 
public class Call 

    // The class contains an ObjectHolder and a <see cref="T:Chili.Opf3.Relations.RelationAttribute">RelationAttribute</see> 
    // that specifies the relation between the parent object and the  
    // related objects. 
    [Relation("UserId", "Id", SaveOrder = SaveOrders.ChildFirst)] 
    private ObjectHolder<User> _user = new ObjectHolder<User>(); 
 
    // The User property accesses the InnerObject property to get 
    // the User object or to set a new one. 
    public User User 
    { 
        get { return _user.InnerObject; } 
        set { _user.InnerObject = value; } 
    } 
     
    // ... Other properties and code. 
}

Remarks

This class is used in a persistent class to hold one single object that is connected with the parent object. When accessing the first time the InnerObject property the related object is loaded. This is called delayed loading and reduces roundtrips to the storage.

Inheritance Hierarchy

System.Object
   Chili.Opf3.Relations.ObjectHolderBase
      Chili.Opf3.Relations.ObjectHolder

Requirements

Namespace: Chili.Opf3.Relations

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

Assembly: Chili.Opf3 (in Chili.Opf3.dll)

See Also