Click or drag to resize

IOptimizedPersistable Interface

add optimized persistence by implementing this interface. We provide OptimizedPersistable as a base class that implements this interface.

Namespace:  VelocityDb
Assembly:  VelocityDb (in VelocityDb.dll) Version: 11.1.0.0 (11.1)
Syntax
public interface IOptimizedPersistable : IComparable

The IOptimizedPersistable type exposes the following members.

Properties
  NameDescription
Public propertyAllowOtherTypesOnSamePage
By default true but override as returning false so that this type of objects isn't sharing pages with other type of objects.
Public propertyCache
By default, the an object cache is determined by a SessionBase constructor parameter but certain types of objects may be re opened more frequently than others, for such types override this to return a value. Caching objects this way can cause out of date object references to stay active due to lacking code to invalidate a cached object when referenced objects are replaced. We will add this automatic invalidation as soon as possible but for now use caution when caching objects. Caching objects that does not strongly reference other objects is OK to do.
Public propertyFieldsLoaded
Gets the field members load state. By default, all members are loaded when a persistent object is opened but if an overrode of LazyLoadFields returns true then the object members are loaded by calling [!:OptimizedPersistable.LoadFields]
Public propertyFlushIfPageFull
By default we flush (write) any updated page we find when looking for an object placement page and the page is considered full (depends on how many objects we permit/page)
Public propertyId
Gets the id of this object. The id is structured as Oid
Public propertyIsPersistent
Gets the persistent state of an object. An object is considered persistent when it has an Oid, that is the Id is not 0
Public propertyIsUpdated
Gets the updated state of the object
Public propertyLazyLoadFields
By default all fields are loaded when opening a persistent object but an option is provided to load members on demand (lazy loading).
Public propertyMaxNumberOfDatabases
Possibly restrict instances of to a single Database. By default this property is UInt32.MaxValue but classes like BTreeSetOidShort, BTreeMapShortOid ... override this property to return 1 since short references are restricted to a single Database.
Public propertyObjectsPerPage
A default for number of objects per database page used when persisting objects without an explicit Placement object or if persisted using Persist(SessionBase, IOptimizedPersistable, Boolean, Boolean) This happens when objects are persisted by reachability from a persistent object. All objects reachable from a persistent object are automatically made persistent.
Public propertyPagesPerDatabase
A default for number of objects per database page used when persisting objects without an explicit Placement object or if persisting using Persist(SessionBase, IOptimizedPersistable, Boolean, Boolean) This happens when objects are persisted by reachability from a persistent object. All objects reachable from a persistent object are automatically made persistent.
Public propertyPlacementDatabaseNumber
Gets the Database Id number to use when placing (persisting) an instance of this class when no other placement directive has been given.
Public propertyRemovedFromIndices
true if call to [!:Update(bool)] or UpdateObject(IOptimizedPersistable, Boolean, Boolean) caused this object to be removed from possible indices
Top
Methods
  NameDescription
Public methodFlushTransients
Flushes batched up objects such as objects added with AddFast(Key)
Public methodGetPage
Get the persistent storage Page of this object
Public methodGetTypeVersion
The database engine needs this internally
Public methodGetWrappedObject
Internally used when IOptimizedPersistable is a wrapper for a non IOptimizedPersistable
Public methodInitializeAfterRead
This function is called when an object has been read from disk and all data members (fields) have been loaded. Override this to provide your own initializations of transient data.
Public methodInitializeAfterRecreate
This function is called when an object has been read from disk before all data members (fields) have been fully loaded. Override this to provide your own initializations of transient data.
Public methodPersist(SessionBase, IOptimizedPersistable, Boolean, Boolean)
Persists this object.
Public methodPersist(Placement, SessionBase, Boolean, Boolean, QueueIOptimizedPersistable)
Persists this object.
Public methodPersistMyReferences
Persists references from this object
Public methodReadMe
Provides a way to customize how an object is read. Used by a code generator
Public methodSetPage
Sets the persistent storage Page of this object
Public methodSetTypeVersion
The database engine needs this internally
Public methodShallowCopyTo
Copies current object to a page
Public methodUnpersist
Removes an object from the persistent store and makes the object a transient object. It does not automatically make referenced objects unpersisted. Best way to do so is to override this virtual function in your own classes.
Public methodUpdate
Call this function before updating any fields of this object
Public methodWriteMe
Provides a way to customize how an object is written. Used by a code generator
Top
See Also