Click or drag to resize

SessionBase Methods

The SessionBase type exposes the following members.

Methods
  NameDescription
Public methodAbort
Transaction control, abort the current transaction
Public methodAllObjectsT
Gets an object used for enumerating all objects in all Databases
Public methodAnyPageWritten
Find out if any pages have been written for a given database in this update transaction
Public methodBeginRead
Transaction control, begin a read only transaction
Public methodBeginUpdate
Transaction control, begin an update transaction.
Public methodBeginUpdate(Boolean)
Transaction control, begin an update transaction.
Public methodCheckpoint
Public methodClearCache
Clears page cache and closes databases. Avoid using this one for now.
Public methodClearCachedObjects
Clears the cache of cached objects.
Public methodClearCachedObjects(Database)
Clears the cache of cached objects within a Database.
Public methodClearCashedPages
Clear cache of cached pages
Public methodClearPageCache
Clears cached pages from cache including page weak references.
Public methodCloseDatabase
Closes a Database
Public methodCommit
Transaction control, commit the current transaction
Public methodCompact
Reduce size of databases, if possible, by first attempting to relocate pages to free areas towards the beginning of each Database file and then by truncating files where unused space begins. Run Compact() outside the scope of any transaction.
Public methodCompact(Database)
Reduce size of database, if possible, by truncating file where unused space begins
Public methodCompareTo
The defualt compare of two SessionBase is by system (bootup) host name and directory
Public methodContainsDatabase
Check if database file exist in a given DatabaseLocation
Public methodCopyAllDatabasesTo
Copies all databases to a selected directory on the local host.
Public methodCreateDirectory
Creates a directory
Public methodCrossTransactionCache
By default databases are only referenced by a WeakReference across transaction boundaries. This means that such Database may or may not be available as a cached database depending on garbage collection activity and if such database also has a strong reference. This function lets you add a strong reference to a Database so the cached Database may be used if version wasn't changed by a different thread since prior transaction. The strong reference is removed once the Database is reopened.
Public methodCrossTransactionCacheAllDatabases
By default databases are referenced by strong references instead of WeakReference across transaction boundaries. This means that such Database may or may not be available as a cached database depending on garbage collection activity and if such database also has a strong reference. This function lets you add a strong reference to all Databases so the cached Database may be used if version wasn't changed by a different thread since prior transaction. A strong reference is removed for any database that get invalidated due to a transaction abort or if another transaction commits a change to it. Check current session state with StrongReferenceDatabaseCaching
Public methodDatabaseNumberOf
Get the database number associated with a specific type. Your application can store any type of object in any database but if the application exclusively use Persist(IOptimizedPersistable, NullableUInt16) or Persist(Object) then this is the database Id that will be used given a type.
Public methodDatabaseStillExist
Check if Database still exist
Public methodDefaultDatabaseLocation
Gets the default (startup) DatabaseLocation
Public methodDeleteDatabase
Delete a database, actual database file delete happens after a successful transaction commit.
Public methodDeleteFile
Delete a file. For internal use.
Public methodDeleteLocation
Deletes a DatabaseLocation, location must first mot have any Databases in it
Public methodDeleteObject
A way to delete an object without requiring that the object be opened first
Public methodDeletePage
Deletes a page from a database. (part of database Sync beta version - not yet fully designed and tested) Used by SyncWith when syncing databases with another replica of the current databases
Public methodDeployGenerateReaderWriter
Part of code generator, not yet ready for public release
Public methodDeployInternalTypes
For internal use only
Public methodDispose
Closes this session
Public methodFileOpen(Database, FileAccess, String, FileMode, Boolean, Int32, Boolean)
Opens a Databasefile for read/update. Internal use only.
Public methodFileOpen(FileInfo, FileAccess, String, FileShare, FileMode, Int32, Boolean, Boolean)
For internal use.
Public methodFirstFreePage
Gets the page number of the first unallocated page in the specified Database
Public methodFlushPageOf
By calling this you force a persisted (has an Id) object to be written to disk (if updated) and indices (if any) to be updated. Other objects on the same page page will also be written.
Public methodFlushUpdates
Write all updated data. This may free up some memory.
Public methodFlushUpdates(Database)
Write any updated/new pages for a specific Database
Public methodFlushUpdatesServers
Make servers Write all updated data. This may free up some memory on the servers. Only effects sessions using VelocityDbServer(s)
Public methodForceDatabaseCacheValidation
Cached data is set to be validated whenever a new transaction is started. This function is provided as a way to force cache validation within a transaction without requiring a commit followed by a new transaction.
Public methodGetEnumerator
Enumerates all open databases for this session
Public methodGetVersion
Gets the version of Database 0
Public methodGlobalObjWrapperGet
Lookup wrapper object for a non IOptimizedPersistable object
Public methodHighestInUseDatabaseNumber
Figure out what the highest in use database number is and return it.
Public methodHighestInUseLocalDatabaseNumber
Figure out what the highest in use database number is on the local host and return it.
Public methodIdOf
Finds the object id of a persistent object
Public methodIndexT
Gets an index of all objects of a certain type
Public methodIndexT(String)
Gets an index of all objects of a certain type
Public methodIndexT(Database)
Gets an index of all objects of a certain type within a given database (attribute OnePerDatabase must be used). If you have updated objects persisted in a prior transaction that you want part of an index. Call FlushUpdates or call Write/> to add such an object to index before querying using an index./>
Public methodIndexT(String, Database)
Gets an index of all objects of a certain type within a given database (attribute OnePerDatabase must be used)
Public methodInUseNumberOfPages
Gets the number of pages currently in use by a Database
Public methodStatic memberIsSameHost
Determine if two host names represent the same tcp/ip host
Public methodIsWorkerThread
Tell if code is executed by index or page write worker thread
Public methodLoadFields
Loads all field values of an object if they are not already loaded.
Public methodLocateDb
Lookup the DatabaseLocation of a Database with a specified database number.
Public methodNewDatabase
Create a new Database with a given database number
Public methodNewLocation
Creates a new DatabaseLocation or updates existing ones
Public methodObjectsT
Enumerates all the objects of a given type
Public methodOfType
Gets an object used for enumerating all objects in all Databases
Public methodOidOf
Finds the object id of a persistent object
Public methodOidShortOf
Finds the object id of a persistent object
Public methodOpenAllDatabases
Open all databases
Public methodOpenDatabase
Opens a Database
Public methodOpenDatabaseLocations
Open the DatabaseLocations object and store it in the session.
Public methodOpenLocationDatabases
Opens all the databases in a given location
Public methodOpenPage
Opens a page for read, used by DatabaseManager for page browsing
Public methodOpenSchema
Get the session active schema
Public methodStatic memberParseCsvRow
Parses a row in a csv file and returns an iterator of column string values
Public methodPersist(Object)
This is the recommended way of persisting objects, it is simple and efficient. Each type is stored in its own database.
Public methodPersist(IOptimizedPersistable, NullableUInt16)
This is the recommended way of persisting objects, it is simple and efficient. Each type is stored in its own database unless object class overrides PlacementDatabaseNumber and returns something other than DefaultPlacementDatabaseNumber.
Public methodPersist(Placement, IOptimizedPersistable)
Persist an object that is an OptimizedPersistable or a subclass
Public methodPersist(Object, IOptimizedPersistable, Boolean)
Persist an object that may or may not be a subclass of OptimizedPersistable
Public methodPersist(Object, Placement, Boolean)
Persist an object that may or may not be a subclass of OptimizedPersistable
Public methodPersist(Placement, IOptimizedPersistable, Schema, UInt16, Boolean, QueueIOptimizedPersistable)
Persists an object
Public methodPossiblyFlushUpdatedPages
Call this function if you may have updated many pages to possibly free up memory if too much memory is in use.
Public methodRegisterClass
Register a class in the persistent schema. It is a good idea to do this explicitly instead of having it happen the first time an object of an unregistered class is made persistent
Public methodRelocateDatabaseLocationFor
After moving/copying directory containing your Database with id dbId call this before starting a transaction to update host and directory of the associated DatabaseLocation. This function does not move the database files, it only updates the DatabaseLocation.
Public methodRelocateDefaultDatabaseLocation
After moving/copying directory containing your Databases 0.odb, 1.odb ... call this before starting a transaction to update host and directory of the default DatabaseLocation. This function does not move the database files, it only updates the DatabaseLocation.
Public methodReplacePage
Only to be used in VelocityDbExtensions while syncing databases
Public methodReplacePersistedType(String, Type)
Updates the Type assocuiated with a VelocityDbType. This can be used when you want to rename a class or move a class to a different namespace. You will need to have the prior Type loaded as it it is defined in the current Schema for this to work. Once the update has been done, you should no longer need to keep the old Type loaded. Be sure to backup all your data before doing this.
Public methodReplacePersistedType(Type, Type)
Updates the Type assocuiated with a VelocityDbType. This can be used when you want to rename a class or move a class to a different namespace. You will need to have the prior Type loaded as it it is defined in the current Schema for this to work. Once the update has been done, you should no longer need to keep the old Type loaded. Be sure to backup all your data before doing this.
Public methodRestoreFrom(DatabaseLocation, DateTime)
Restores Databases and pages from a backup DatabaseLocation. Existing data will be merged with the restored data unless existing Databases to restore are deleted before the restore.
Public methodRestoreFrom(String, String, UInt32, DateTime)
Restores a DatabaseLocation
Public methodStatic memberSetMinMaxStringIntern
A persistent string read into memory from a Database is interned using Intern(String) to speed up comparisons and conserve memory (when the same string occurs in many places)
Public methodSetTraceAllDbActivity
Enable some Trace output about persistent events related to all databases and pages. Add a Trace listener to get to Console window: Trace.Listeners.Add(new ConsoleTraceListener());
Public methodSetTraceDbActivity
Enable some Trace output about persistent events related to a Database. Add a Trace listener to get to Console window: Trace.Listeners.Add(new ConsoleTraceListener());
Public methodStatic memberStringToType
Gets a Type given a string representation of a type
Public methodSubscribeToChanges
Subscribe to committed database changes of instances of a type when an an optional property evaluates to true.
Public methodTryDatabase
Gets the current database to try
Public methodUnpersist
Use this when you want to delete objects that are not assignable as IOptimizedPersistable
Public methodUnsubscribeToChanges
Unsubscribe to committed database changes of instances of a type when an optional property evaluates to true.
Public methodUpdateClass
Let VelocityDB know that changes have been made to a class so that the schema manager will create a new TypeVersion and use the new version for all new objects of the specified Type.
Public methodUpdateDatabase
Request an update lock on a database
Public methodUpdateObject(Object)
Tag an object as updated so that it will be updated persistently
Public methodUpdateObject(IOptimizedPersistable)
Tag an object as updated so that it will be updated persistently
Public methodUpdateObject(Object, Action)
Provides a way to update an object in a multi thraeded scenario where we must make sure that object page isn't flushed until updates to object are done.
Public methodUpdateObject(IOptimizedPersistable, Action)
Provides a way to update an object in a multi thraeded scenario where we must make sure that object page isn't flushed until updates to object are done.
Public methodUpdateObject(IOptimizedPersistable, Boolean, Boolean)
Updates an object
Public methodUpdatePage
Update a Page. Used by VelocityDBExtensions project
Public methodVerify
Verifies that databases are valid by reading and following references. An exception is thrown if an issue is found.
Public methodWaitForIndexUpdates
Internal Use and in VelocityDBExtensions
Public methodWritePageBytes
Top
Extension Methods
  NameDescription
Public Extension MethodExportToCSV
Export all persistent objects to .csv files, one file for each Type and version of Type. This is preview release, format may change. ImportFromCSV can be used to recreate your data. Note that Microsoft Excel can't handle many of these CSV files due to a field value limitation (at about 33000 chars) Notepad++ is one application that can read these files. Some fields like array data are encoded http://msdn.microsoft.com/en-us/library/dhx0d524(v=vs.110).aspx
(Defined by ImportExportCsv.)
Public Extension MethodExportToJsonT(UInt64)Overloaded. (Defined by JsonImportExport.)
Public Extension MethodExportToJsonT(Oid)Overloaded. (Defined by JsonImportExport.)
Public Extension MethodExportToJsonT(Boolean, Boolean)Overloaded. (Defined by JsonImportExport.)
Public Extension MethodImportFromCSV
Restores database files, pages and objects from a .csv file data created with ExportToCSV
(Defined by ImportExportCsv.)
Public Extension MethodImportJsonT (Defined by JsonImportExport.)
Public Extension MethodMicrosoftSync (Defined by Sync.)
Public Extension MethodSyncWith(SessionBase)Overloaded. (Defined by Sync.)
Public Extension MethodSyncWith(SessionBase, FuncSessionBase, UInt64, Change, Boolean)Overloaded. (Defined by Sync.)
Top
See Also