SessionBase Class |
Namespace: VelocityDb.Session
The SessionBase type exposes the following members.
Name | Description | |
---|---|---|
AddToIndexInSeperateThread |
Allow adding objects to indices to be done in a worker thread instead of in main thread.
| |
AssumeLocalHost |
SessionNoServer ignores DatabaseLocation host value, it assumes localhost, ServerSessionClient does not assume local host, it follows the DatabaseLocation HostName value.
| |
BaseDatabasePath |
If specified boot path (system database path) in session constructor isn't an absolute path then this base path is prefixed to make an absolute path.
| |
BTreeAddFastTransientBatchSize |
Default batch size for BTree AddFast api, initially set to 100
| |
ClearAllCachedObjectsWhenDetectingUpdatedDatabase |
By default we clear all cached object when at the beginning of a transaction we detect an updated Database within our cached databases.
Same logic is applied when calling ForceDatabaseCacheValidation.
We do so because most of the time an object in one database have (strong) references to objects in other databases.
If Database A is NOT updated but database B is and an object in database A is cached with a strong reference to an object in database B then our cached
object in database A may contain a stale/incorrect reference to object in database B. This is why we, by default, invalidate all cached objects when we
detect a modified database within our cached databases. However, if you design your database schema without strong references between databases then you
do not need to invalidate cached objects for other databases, only the ones that have changed. By consistently using WeakIOptimizedPersistableReferenceT,
BTreeSetKey and BTreeMapKey, Value, you can keep references weak between databases. In such cases, set this property to false.
| |
ClientCache |
Gets the client page cache object
| |
DatabaseLocations |
Gets the DatabaseLocationsDatabaseLocations for the session.
| |
Databases |
Gets a list of the currently opened databases
| |
DefaultCompressPages |
By default false, set to true if you want to change the default for newly created DatabaseLocation.
| |
DefaultNumberOfObjectsPerPage |
Default number of objects per page is 9999
| |
DefaultStringComparer |
Set the StringComparer to use when no application provided comparator is provided. By default we will then use StringComparer.Ordinal.
| |
DeletedOids |
Collected Oid for unpersisted objects within an update transaction.
Ids are only collected if NotifyBeforeCommit is non null.
| |
DoWindowsAuthentication |
By default do not use windows authentication when talking to VelocitydbServer's on other hosts.
| |
EmbedISerializableLists |
Starting in version 7.1.6, ListT bits are NOT by default stored with its parent object, instead each such ListT is stored with its own object Id.
This change was necessary in order to handle circular references via ListT objects within an ISerializable serialization.
Set this value to true if you have existing persisted ISerializable with ListT or else we will try to read the lists as non embedded when they are not.
| |
EnableAutoPageFlush |
Pages may be flushed when memory available is low unless you set tis property to false. You would want it to be enabled unless you are trying to share a non SessionNoServerShared session by working on different databases in multiple threads. As in Wikipedia sample application.
| |
EnableSyncByTrackingChanges |
Enable database and page change tracking. Turn off within an update transaction so that prior change set can be deleted.
| |
FileBytesChunkSize |
When transferring complete files from a server, we send the file bytes in chunks of this size.
| |
FileShareReader | ||
FileShareUpdater | ||
InCommit |
Indicates if we are within a transaction commit.
| |
InMemoryOnly |
Gets information about this session, is it an in-memory only session or a session that persists data
| |
InTransaction |
Indicates if we are within an active transaction.
| |
InUpdateTransaction |
Indicates if we are within an active update transaction.
| |
IsDisposed |
Check if session has been disposed
| |
LocalHost |
Get the host name of your local host (the machine you are using)
| |
MaxStringLengthToIntern |
Get the maximum size a string must have before VelocityDB internals interns, Intern(String), string when read from a Database.
| |
MaxUpdateTransactionLogHistory |
Determines max number of UpdateTransaction objects we maintain in update transaction log in Database 0, initially set to 9990
| |
MinStringLengthToIntern |
Get the minimum size a string must have before VelocityDB internals interns, Intern(String), string when read from a Database.
| |
NewDatabases |
Get a list of all new databases created within this transaction
| |
NewOids |
Collected Oid for newly persisted objects within an update transaction.
Ids are only collected if NotifyBeforeCommit is non null.
| |
NotifyBeforeCommit |
Set to an Action of your choice if you want to get notified right before commit of an update transaction.
| |
ObjectCachingDefaultPolicy |
Get/Set default value for Cache | |
OptimisticLocking | ||
StrongReferenceDatabaseCaching |
Is current session caching Databases using strong references or just by weak references.
Set in session constructor or by calling CrossTransactionCacheAllDatabases(Boolean).
| |
SystemDirectory |
Get the path to the directory of the system Databases (0.odb, 1.odb, 2.odb ...) of this session.
| |
SystemHostName |
Get the host name of the system Databases (0.odb, 1.odb, 2.odb ...) of this session.
| |
TextEncoding |
All text encoding is done with utf8
| |
TraceDBActivity | ||
TraceIndexUsage |
If set to true, each time an index (BTreeSet) is used in a LINQ query expression, we output a line about that to the console output.
| |
TransactionNumber |
Gets the transaction number of the current session
| |
UpdatedOids |
Collected Oid for updated objects within an update transaction.
Ids are only collected if NotifyBeforeCommit is non null.
| |
UseExternalStorageApi |
This is specifically for Windows Phone API, set to true when you want to access databases from a memory card.
| |
WaitForLockMilliseconds |
Get/Set the max time waiting for a lock to clear with pessimistic locking
| |
WriteToDiskInSeperateDatabaseThreads |
Allow object serialization and page writes to happen in worker threads, one per database, instead of in main session thread.
AddToIndexInSeperateThread must also be enabled for this to work.
|
Name | Description | |
---|---|---|
Abort |
Transaction control, abort the current transaction
| |
AllObjectsT |
Gets an object used for enumerating all objects in all Databases
| |
AnyPageWritten |
Find out if any pages have been written for a given database in this update transaction
| |
BeginRead |
Transaction control, begin a read only transaction
| |
BeginUpdate |
Transaction control, begin an update transaction.
| |
BeginUpdate(Boolean) |
Transaction control, begin an update transaction.
| |
Checkpoint |
Same as Commit(Boolean, Boolean) followed by BeginUpdate | |
ClearCache |
Clears page cache and closes databases. Avoid using this one for now.
| |
ClearCachedObjects |
Clears the cache of cached objects.
| |
ClearCachedObjects(Database) |
Clears the cache of cached objects within a Database.
| |
ClearCashedPages |
Clear cache of cached pages
| |
ClearPageCache |
Clears cached pages from cache including page weak references.
| |
CloseDatabase |
Closes a Database
| |
Commit |
Transaction control, commit the current transaction
| |
Compact |
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.
| |
Compact(Database) |
Reduce size of database, if possible, by truncating file where unused space begins
| |
CompareTo |
The defualt compare of two SessionBase is by system (bootup) host name and directory
| |
ContainsDatabase |
Check if database file exist in a given DatabaseLocation | |
CopyAllDatabasesTo |
Copies all databases to a selected directory on the local host.
| |
CreateDirectory |
Creates a directory
| |
CrossTransactionCache |
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.
| |
CrossTransactionCacheAllDatabases |
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 | |
DatabaseNumberOf |
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.
| |
DatabaseStillExist |
Check if Database still exist
| |
DefaultDatabaseLocation |
Gets the default (startup) DatabaseLocation
| |
DeleteDatabase |
Delete a database, actual database file delete happens after a successful transaction commit.
| |
DeleteFile |
Delete a file. For internal use.
| |
DeleteLocation |
Deletes a DatabaseLocation, location must first mot have any Databases in it
| |
DeleteObject |
A way to delete an object without requiring that the object be opened first
| |
DeletePage |
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
| |
DeployGenerateReaderWriter |
Part of code generator, not yet ready for public release
| |
DeployInternalTypes |
For internal use only
| |
Dispose |
Closes this session
| |
FileOpen(Database, FileAccess, String, FileMode, Boolean, Int32, Boolean) |
Opens a Databasefile for read/update. Internal use only.
| |
FileOpen(FileInfo, FileAccess, String, FileShare, FileMode, Int32, Boolean, Boolean) |
For internal use.
| |
FirstFreePage |
Gets the page number of the first unallocated page in the specified Database
| |
FlushPageOf |
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.
| |
FlushUpdates |
Write all updated data. This may free up some memory.
| |
FlushUpdates(Database) |
Write any updated/new pages for a specific Database
| |
FlushUpdatesServers |
Make servers Write all updated data. This may free up some memory on the servers. Only effects sessions using VelocityDbServer(s)
| |
ForceDatabaseCacheValidation |
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.
| |
GetEnumerator |
Enumerates all open databases for this session
| |
GetVersion |
Gets the version of Database 0
| |
GlobalObjWrapperGet |
Lookup wrapper object for a non IOptimizedPersistable object
| |
HighestInUseDatabaseNumber |
Figure out what the highest in use database number is and return it.
| |
HighestInUseLocalDatabaseNumber |
Figure out what the highest in use database number is on the local host and return it.
| |
IdOf |
Finds the object id of a persistent object
| |
IndexT |
Gets an index of all objects of a certain type
| |
IndexT(String) |
Gets an index of all objects of a certain type
| |
IndexT(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./>
| |
IndexT(String, Database) |
Gets an index of all objects of a certain type within a given database (attribute OnePerDatabase must be used)
| |
InUseNumberOfPages |
Gets the number of pages currently in use by a Database
| |
IsSameHost |
Determine if two host names represent the same tcp/ip host
| |
IsWorkerThread |
Tell if code is executed by index or page write worker thread
| |
LoadFields |
Loads all field values of an object if they are not already loaded.
| |
LocateDb |
Lookup the DatabaseLocation of a Database with a specified database number.
| |
NewDatabase |
Create a new Database with a given database number
| |
NewLocation |
Creates a new DatabaseLocation or updates existing ones
| |
ObjectsT |
Enumerates all the objects of a given type
| |
OfType |
Gets an object used for enumerating all objects in all Databases
| |
OidOf |
Finds the object id of a persistent object
| |
OidShortOf |
Finds the object id of a persistent object
| |
OpenAllDatabases |
Open all databases
| |
OpenDatabase |
Opens a Database
| |
OpenDatabaseLocations |
Open the DatabaseLocations object and store it in the session.
| |
OpenLocationDatabases |
Opens all the databases in a given location
| |
OpenPage |
Opens a page for read, used by DatabaseManager for page browsing
| |
OpenSchema |
Get the session active schema
| |
ParseCsvRow |
Parses a row in a csv file and returns an iterator of column string values
| |
Persist(Object) |
This is the recommended way of persisting objects, it is simple and efficient. Each type is stored in its own database.
| |
Persist(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.
| |
Persist(Placement, IOptimizedPersistable) |
Persist an object that is an OptimizedPersistable or a subclass
| |
Persist(Object, IOptimizedPersistable, Boolean) |
Persist an object that may or may not be a subclass of OptimizedPersistable
| |
Persist(Object, Placement, Boolean) |
Persist an object that may or may not be a subclass of OptimizedPersistable
| |
Persist(Placement, IOptimizedPersistable, Schema, UInt16, Boolean, QueueIOptimizedPersistable) |
Persists an object
| |
PossiblyFlushUpdatedPages |
Call this function if you may have updated many pages to possibly free up memory if too much memory is in use.
| |
RegisterClass |
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
| |
RelocateDatabaseLocationFor |
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.
| |
RelocateDefaultDatabaseLocation |
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.
| |
ReplacePage |
Only to be used in VelocityDbExtensions while syncing databases
| |
ReplacePersistedType(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.
| |
ReplacePersistedType(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.
| |
RestoreFrom(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.
| |
RestoreFrom(String, String, UInt32, DateTime) |
Restores a DatabaseLocation | |
SetMinMaxStringIntern |
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)
| |
SetTraceAllDbActivity |
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());
| |
SetTraceDbActivity |
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());
| |
StringToType |
Gets a Type given a string representation of a type
| |
SubscribeToChanges |
Subscribe to committed database changes of instances of a type when an an optional property evaluates to true.
| |
TryDatabase |
Gets the current database to try
| |
Unpersist |
Use this when you want to delete objects that are not assignable as IOptimizedPersistable | |
UnsubscribeToChanges |
Unsubscribe to committed database changes of instances of a type when an optional property evaluates to true.
| |
UpdateClass |
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.
| |
UpdateDatabase |
Request an update lock on a database
| |
UpdateObject(Object) |
Tag an object as updated so that it will be updated persistently
| |
UpdateObject(IOptimizedPersistable) |
Tag an object as updated so that it will be updated persistently
| |
UpdateObject(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.
| |
UpdateObject(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.
| |
UpdateObject(IOptimizedPersistable, Boolean, Boolean) |
Updates an object
| |
UpdatePage |
Update a Page. Used by VelocityDBExtensions project
| |
Verify |
Verifies that databases are valid by reading and following references. An exception is thrown if an issue is found.
| |
WaitForIndexUpdates |
Internal Use and in VelocityDBExtensions
| |
WritePageBytes |
Name | Description | |
---|---|---|
Assembly | ||
IndexDescriptorDatabaseNumber |
Database 3 is dedicated to keeping track of index usage
| |
s_serverTcpIpPortNumber |
By default port number 7031 (7032 if .net core) is used for communication with VelocityDBServer. Change the value here and also in VelocityDbServer.exe.config if you need to use a different port number.
| |
s_typeDatabaseIdOffsetFromTypeShortId |
Determines database Id to use for a certain VelocityDbType instance
| |
s_typeDatabaseIdOverflowIndexCollisionOffset |
If additional databases are required for storing instances of some index, start by attempting creating database at this offset from original
| |
s_typeDatabaseIdOverflowOffset |
If additional databases are required for storing instances of some type, start by attempting creating database at this offset from original
|
Name | Description | |
---|---|---|
ExportToCSV |
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.) | |
ExportToJsonT(UInt64) | Overloaded. (Defined by JsonImportExport.) | |
ExportToJsonT(Oid) | Overloaded. (Defined by JsonImportExport.) | |
ExportToJsonT(Boolean, Boolean) | Overloaded. (Defined by JsonImportExport.) | |
ImportFromCSV |
Restores database files, pages and objects from a .csv file data created with ExportToCSV
(Defined by ImportExportCsv.) | |
ImportJsonT | (Defined by JsonImportExport.) | |
MicrosoftSync | (Defined by Sync.) | |
SyncWith(SessionBase) | Overloaded. (Defined by Sync.) | |
SyncWith(SessionBase, FuncSessionBase, UInt64, Change, Boolean) | Overloaded. (Defined by Sync.) |