Chili.Opf3 Send comments on this topic.
PersistDepths Enumeration
See Also   Example
Chili.Opf3 Namespace : PersistDepths Enumeration




Allows to specify the depth of the loaded object graph that is persisted during the save process.

Syntax

Visual Basic (Declaration) 
Public Enum PersistDepths 
   Inherits Enum
Visual Basic (Usage)Copy Code
Dim instance As PersistDepths
C# 
public enum PersistDepths : Enum 
Managed Extensions for C++ 
__value public enum PersistDepths : public Enum 
C++/CLI 
public enum class PersistDepths : public Enum 

Members

MemberDescription
None No persist depth is specified.
Flat When using this option only the object itself is persisted. Connected object collections or connected objects aren't persisted.
FirstLevel The first level of connected objects is persisted. This means that the object itself plus the first level of loaded connected objects and collections are persisted. If those objects contain other connected objects they aren't persisted.
FullObjectGraph The whole object graph is persited. All loaded connected objects in any level are persisted.

Example

The following example shows you how to use the enumeration while saving persistent objects.
C#Copy Code
// Create a storage and the context. 
OleDbStorage storage = new OleDbStorage("connectionstring ..."); 
ObjectContext context = new ObjectContext(storage); 
  
// Load the user with the Id '1'. 
User user = context.GetObject<User>("Id = {0}", "1"); 
if (user != null) 

    // Get the calls of the user. The calls are only loaded 
    // during the first request of the property (delayed loading). 
    ObjectSet<Call> calls = user.Calls; 

  
// Save the user object. Since flat is used only the object 
// without the calls is saved. 
context.PersistChanges(user, PersistDepth.Flat); 
  
// Save the user object. Using FirstLevel means that the object 
// itself plus the calls are saved. If each call would contain 
// another connected object or collection that wouldn't be saved. 
context.PersistChanges(user, PersistDepth.FirstLevel); 
    

Remarks

This enumeration is used in the PersistChanges method of the ObjectContext and allows to specify which part of the loaded object graph is persisted. It's important to know that this enumeration applies only to loaded related objects and collections (See ObjectHolder, ObjectSetHolder and ObjectListHolder for further information about delayed loading of related objects). This means that not loaded related collections and objects are excluded by design.

Inheritance Hierarchy

System.Object
   System.ValueType
      System.Enum
         Chili.Opf3.PersistDepths

Requirements

Namespace: Chili.Opf3

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