Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
Waher.Persistence.Database Class Reference

Static interface for database persistence. In order to work, a database provider has to be assigned to it. This is ideally done as one of the first steps in the startup of an application. More...

Static Public Member Functions

static void Register (IDatabaseProvider DatabaseProvider)
 Registers a database provider for use from the static Database class, throughout the lifetime of the application. More...
 
static void Register (IDatabaseProvider DatabaseProvider, bool Lock)
 Registers a database provider for use from the static Database class, throughout the lifetime of the application. More...
 
static async Task Insert (object Object)
 Inserts an object into the default collection of the database. More...
 
static async Task Insert (params object[] Objects)
 Inserts a set of objects into the default collection of the database. More...
 
static async Task Insert (IEnumerable< object > Objects)
 Inserts a set of objects into the default collection of the database. More...
 
static async Task InsertLazy (object Object)
 Inserts an object into the database, if unlocked. If locked, object will be inserted at next opportunity. More...
 
static async Task InsertLazy (params object[] Objects)
 Inserts an object into the database, if unlocked. If locked, object will be inserted at next opportunity. More...
 
static async Task InsertLazy (IEnumerable< object > Objects)
 Inserts an object into the database, if unlocked. If locked, object will be inserted at next opportunity. More...
 
static Task< IEnumerable< T > > Find< T > (params string[] SortOrder)
 Finds objects of a given class T . More...
 
static Task< IEnumerable< T > > Find< T > (Filter Filter, params string[] SortOrder)
 Finds objects of a given class T . More...
 
static Task< IEnumerable< T > > Find< T > (int Offset, int MaxCount, params string[] SortOrder)
 Finds objects of a given class T . More...
 
static Task< IEnumerable< T > > Find< T > (int Offset, int MaxCount, Filter Filter, params string[] SortOrder)
 Finds objects of a given class T . More...
 
static Task< IEnumerable< object > > Find (string Collection, params string[] SortOrder)
 Finds objects in a given collection. More...
 
static Task< IEnumerable< object > > Find (string Collection, Filter Filter, params string[] SortOrder)
 Finds objects in a given collection. More...
 
static Task< IEnumerable< object > > Find (string Collection, int Offset, int MaxCount, params string[] SortOrder)
 Finds objects in a given collection. More...
 
static Task< IEnumerable< object > > Find (string Collection, int Offset, int MaxCount, Filter Filter, params string[] SortOrder)
 Finds objects in a given collection. More...
 
static Task< IEnumerable< T > > Find< T > (string Collection, string[] SortOrder)
 Finds objects in a given collection. More...
 
static Task< IEnumerable< T > > Find< T > (string Collection, Filter Filter, params string[] SortOrder)
 Finds objects in a given collection. More...
 
static Task< IEnumerable< T > > Find< T > (string Collection, int Offset, int MaxCount, params string[] SortOrder)
 Finds objects in a given collection. More...
 
static Task< IEnumerable< T > > Find< T > (string Collection, int Offset, int MaxCount, Filter Filter, params string[] SortOrder)
 Finds objects in a given collection. More...
 
static Task< IPage< T > > FindFirst< T > (int PageSize, params string[] SortOrder)
 Finds the first page of objects of a given class T . More...
 
static Task< IPage< T > > FindFirst< T > (int PageSize, Filter Filter, params string[] SortOrder)
 Finds the first page of objects of a given class T . More...
 
static Task< IPage< object > > FindFirst (string Collection, int PageSize, params string[] SortOrder)
 Finds the first page of objects in a given collection. More...
 
static Task< IPage< object > > FindFirst (string Collection, int PageSize, Filter Filter, params string[] SortOrder)
 Finds the first page of objects in a given collection. More...
 
static Task< IPage< T > > FindFirst< T > (string Collection, int PageSize, Filter Filter, params string[] SortOrder)
 Finds the first page of objects in a given collection. More...
 
static Task< IPage< T > > FindNext< T > (IPage< T > Page)
 Finds the next page of objects of a given class T . More...
 
static Task< IPage< object > > FindNext (IPage< object > Page)
 Finds the next page of objects in a given collection. More...
 
static async Task< PaginatedEnumerator< T > > Enumerate< T > (int PageSize, params string[] SortOrder)
 Enumerates objects of a given class T available in the database, by retrieving items from the database in page chunks and looping through them page for page. More...
 
static async Task< PaginatedEnumerator< T > > Enumerate< T > (int PageSize, Filter Filter, params string[] SortOrder)
 Finds the first page of objects of a given class T . More...
 
static async Task< PaginatedEnumerator< object > > Enumerate (string Collection, int PageSize, params string[] SortOrder)
 Finds the first page of objects in a given collection. More...
 
static async Task< PaginatedEnumerator< object > > Enumerate (string Collection, int PageSize, Filter Filter, params string[] SortOrder)
 Finds the first page of objects in a given collection. More...
 
static async Task< PaginatedEnumerator< T > > Enumerate< T > (string Collection, int PageSize, Filter Filter, params string[] SortOrder)
 Finds the first page of objects in a given collection. More...
 
static async Task< T > FindFirstDeleteRest< T > (params string[] SortOrder)
 Finds the first object of a given class T and deletes the rest. More...
 
static async Task< T > FindFirstDeleteRest< T > (Filter Filter, params string[] SortOrder)
 Finds the first object of a given class T and deletes the rest. More...
 
static async Task< T > FindFirstIgnoreRest< T > (params string[] SortOrder)
 Finds the first object of a given class T and ignores the rest. More...
 
static async Task< T > FindFirstIgnoreRest< T > (Filter Filter, params string[] SortOrder)
 Finds the first object of a given class T and ignores the rest. More...
 
static async Task Update (object Object)
 Updates an object in the database. More...
 
static async Task Update (params object[] Objects)
 Updates a collection of objects in the database. More...
 
static async Task Update (IEnumerable< object > Objects)
 Updates a collection of objects in the database. More...
 
static async Task UpdateLazy (object Object)
 Updates an object in the database, if unlocked. If locked, object will be updated at next opportunity. More...
 
static async Task UpdateLazy (params object[] Objects)
 Updates a collection of objects in the database, if unlocked. If locked, objects will be updated at next opportunity. More...
 
static async Task UpdateLazy (IEnumerable< object > Objects)
 Updates a collection of objects in the database, if unlocked. If locked, objects will be updated at next opportunity. More...
 
static async Task Delete (object Object)
 Deletes an object in the database. More...
 
static async Task Delete (params object[] Objects)
 Deletes a collection of objects in the database. More...
 
static async Task Delete (IEnumerable< object > Objects)
 Deletes a collection of objects in the database. More...
 
static async Task DeleteLazy (object Object)
 Deletes an object in the database, if unlocked. If locked, object will be deleted at next opportunity. More...
 
static async Task DeleteLazy (params object[] Objects)
 Deletes a collection of objects in the database, if unlocked. If locked, objects will be deleted at next opportunity. More...
 
static async Task DeleteLazy (IEnumerable< object > Objects)
 Deletes a collection of objects in the database, if unlocked. If locked, objects will be deleted at next opportunity. More...
 
static Task< IEnumerable< T > > FindDelete< T > (params string[] SortOrder)
 Finds objects of a given class T and deletes them in the same atomic operation. More...
 
static async Task< IEnumerable< T > > FindDelete< T > (int Offset, int MaxCount, params string[] SortOrder)
 Finds objects of a given class T and deletes them in the same atomic operation. More...
 
static Task< IEnumerable< T > > FindDelete< T > (Filter Filter, params string[] SortOrder)
 Finds objects of a given class T and deletes them in the same atomic operation. More...
 
static async Task< IEnumerable< T > > FindDelete< T > (int Offset, int MaxCount, Filter Filter, params string[] SortOrder)
 Finds objects of a given class T and deletes them in the same atomic operation. More...
 
static Task< IEnumerable< object > > FindDelete (string Collection, params string[] SortOrder)
 Finds objects in a given collection and deletes them in the same atomic operation. More...
 
static async Task< IEnumerable< object > > FindDelete (string Collection, int Offset, int MaxCount, params string[] SortOrder)
 Finds objects in a given collection and deletes them in the same atomic operation. More...
 
static Task< IEnumerable< object > > FindDelete (string Collection, Filter Filter, params string[] SortOrder)
 Finds objects in a given collection and deletes them in the same atomic operation. More...
 
static async Task< IEnumerable< object > > FindDelete (string Collection, int Offset, int MaxCount, Filter Filter, params string[] SortOrder)
 Finds objects in a given collection and deletes them in the same atomic operation. More...
 
static Task DeleteLazy< T > (params string[] SortOrder)
 Finds objects of a given class T and deletes them in the same atomic operation. More...
 
static Task DeleteLazy< T > (int Offset, int MaxCount, params string[] SortOrder)
 Finds objects of a given class T and deletes them in the same atomic operation. More...
 
static Task DeleteLazy< T > (Filter Filter, params string[] SortOrder)
 Finds objects of a given class T and deletes them in the same atomic operation. More...
 
static Task DeleteLazy< T > (int Offset, int MaxCount, Filter Filter, params string[] SortOrder)
 Finds objects of a given class T and deletes them in the same atomic operation. More...
 
static Task DeleteLazy (string Collection, params string[] SortOrder)
 Finds objects in a given collection and deletes them in the same atomic operation. More...
 
static Task DeleteLazy (string Collection, int Offset, int MaxCount, params string[] SortOrder)
 Finds objects in a given collection and deletes them in the same atomic operation. More...
 
static Task DeleteLazy (string Collection, Filter Filter, params string[] SortOrder)
 Finds objects in a given collection and deletes them in the same atomic operation. More...
 
static Task DeleteLazy (string Collection, int Offset, int MaxCount, Filter Filter, params string[] SortOrder)
 Finds objects in a given collection and deletes them in the same atomic operation. More...
 
static Task< T > TryLoadObject< T > (object ObjectId)
 Tries to load an object given its Object ID ObjectId and its class type T . More...
 
static Task< T > TryLoadObject< T > (string CollectionName, object ObjectId)
 Tries to load an object given its Object ID ObjectId and its class type T . More...
 
static Task< object > TryLoadObject (string CollectionName, object ObjectId)
 Tries to load an object given its Object ID ObjectId and its collection name CollectionName . More...
 
static async Task< T > LoadObject< T > (object ObjectId)
 Loads an object given its Object ID ObjectId and its base type T . More...
 
static async Task< T > LoadObject< T > (string CollectionName, object ObjectId)
 Loads an object given its Object ID ObjectId and its collection name CollectionName . More...
 
static async Task< object > LoadObject (string CollectionName, object ObjectId)
 Loads an object given its Object ID ObjectId and its collection name CollectionName . More...
 
static Task< bool > Export (IDatabaseExport Output)
 Performs an export of the database. More...
 
static Task< bool > Export (IDatabaseExport Output, string[] CollectionNames)
 Performs an export of the database. More...
 
static Task< bool > Export (IDatabaseExport Output, string[] CollectionNames, ProfilerThread Thread)
 Performs an export of the database. More...
 
static Task Iterate< T > (IDatabaseIteration< T > Recipient)
 Performs an iteration of contents of the entire database. More...
 
static Task Iterate< T > (IDatabaseIteration< T > Recipient, string[] CollectionNames)
 Performs an iteration of contents of the entire database. More...
 
static Task Iterate< T > (IDatabaseIteration< T > Recipient, string[] CollectionNames, ProfilerThread Thread)
 Performs an iteration of contents of the entire database. More...
 
static async Task Clear (string CollectionName)
 Clears a collection of all objects. More...
 
static Task< string[]> Analyze (XmlWriter Output, string XsltPath, string ProgramDataFolder, bool ExportData)
 Analyzes the database and exports findings to XML. More...
 
static Task< string[]> Analyze (XmlWriter Output, string XsltPath, string ProgramDataFolder, bool ExportData, ProfilerThread Thread)
 Analyzes the database and exports findings to XML. More...
 
static Task< string[]> Repair (XmlWriter Output, string XsltPath, string ProgramDataFolder, bool ExportData)
 Analyzes the database and repairs it if necessary. Results are exported to XML. More...
 
static async Task< string[]> Repair (XmlWriter Output, string XsltPath, string ProgramDataFolder, bool ExportData, ProfilerThread Thread)
 Analyzes the database and repairs it if necessary. Results are exported to XML. More...
 
static Task< string[]> Analyze (XmlWriter Output, string XsltPath, string ProgramDataFolder, bool ExportData, bool Repair)
 Analyzes the database and exports findings to XML. More...
 
static async Task< string[]> Analyze (XmlWriter Output, string XsltPath, string ProgramDataFolder, bool ExportData, bool Repair, ProfilerThread Thread)
 Analyzes the database and exports findings to XML. More...
 
static string[] GetFlaggedCollectionNames ()
 Gets the names of the collections that have been flagged as possibly corrupt. More...
 
static void BeginRepair (string Collection)
 Is called when reparation of a collection is begin. More...
 
static void EndRepair (string Collection)
 Is called when reparation of a collection is ended. More...
 
static Exception FlagForRepair (string Collection, string Reason)
 Flags a collection for repairing. More...
 
static Task AddIndex (string CollectionName, string[] FieldNames)
 Adds an index to a collection, if one does not already exist. More...
 
static Task RemoveIndex (string CollectionName, string[] FieldNames)
 Removes an index from a collection, if one exist. More...
 
static Task StartBulk ()
 Starts bulk-proccessing of data. Must be followed by a call to EndBulk. More...
 
static Task EndBulk ()
 Ends bulk-processing of data. Must be called once for every call to StartBulk. More...
 
static string[] ToStringArray (this CaseInsensitiveString[] A)
 Converts a case insensitive string array to a normal string array. More...
 
static CaseInsensitiveString[] ToCaseInsensitiveStringArray (this string[] A)
 Converts a case insensitive string array to a normal string array. More...
 
static Task< IPersistentDictionaryGetDictionary (string Collection)
 Gets a persistent dictionary containing objects in a collection. More...
 
static Task< string[]> GetDictionaries ()
 Gets an array of available dictionary collections. More...
 
static Task< string[]> GetCollections ()
 Gets an array of available collections. More...
 
static Task< string > GetCollection (Type Type)
 Gets the collection corresponding to a given type. More...
 
static Task< string > GetCollection (Object Object)
 Gets the collection corresponding to a given object. More...
 
static Task< bool > IsLabel (string Collection, string Label)
 Checks if a string is a label in a given collection. More...
 
static Task< string[]> GetLabels (string Collection)
 Gets an array of available labels for a collection. More...
 
static Task< object > TryGetObjectId (object Object)
 Tries to get the Object ID of an object, if it exists. More...
 
static Task DropCollection (string CollectionName)
 Drops a collection, if it exist. More...
 
static string WildcardToRegex (string s, string Wildcard)
 Converts a wildcard string to a regular expression string. More...
 
static Task< GenericObjectGeneralize (object Object)
 Creates a generalized representation of an object. More...
 
static Task< object > Specialize (GenericObject Object)
 Creates a specialized representation of a generic object. More...
 
static string[] GetExcludedCollections ()
 Gets an array of collections that should be excluded from backups. More...
 

Properties

static IDatabaseProvider Provider [get]
 Registered database provider. More...
 
static bool HasProvider [get]
 If a database provider is registered. More...
 
static bool Locked [get]
 If the datbase provider has been locked for the rest of the run-time of the application. More...
 

Events

static ObjectEventHandler ObjectInserted = null
 Event raised when an object has been inserted. More...
 
static ObjectEventHandler ObjectUpdated = null
 Event raised when an object has been updated. More...
 
static ObjectEventHandler ObjectDeleted = null
 Event raised when an object has been deleted. More...
 
static CollectionEventHandler CollectionCleared = null
 Event raised when a collection has been cleared. More...
 
static CollectionRepairedEventHandler CollectionRepaired = null
 Event raised when a collection has been repaired. More...
 

Detailed Description

Static interface for database persistence. In order to work, a database provider has to be assigned to it. This is ideally done as one of the first steps in the startup of an application.

Definition at line 18 of file Database.cs.

Member Function Documentation

◆ AddIndex()

static Task Waher.Persistence.Database.AddIndex ( string  CollectionName,
string[]  FieldNames 
)
static

Adds an index to a collection, if one does not already exist.

Parameters
CollectionNameName of collection.
FieldNamesSort order. Each string represents a field name. By default, sort order is ascending. If descending sort order is desired, prefix the field name by a hyphen (minus) sign.

Definition at line 1467 of file Database.cs.

◆ Analyze() [1/4]

static Task< string[]> Waher.Persistence.Database.Analyze ( XmlWriter  Output,
string  XsltPath,
string  ProgramDataFolder,
bool  ExportData 
)
static

Analyzes the database and exports findings to XML.

Parameters
OutputXML Output.
XsltPathOptional XSLT to use to view the output.
ProgramDataFolderProgram data folder. Can be removed from filenames used, when referencing them in the report.
ExportDataIf data in database is to be exported in output.
Returns
Collections with errors found.

Definition at line 1237 of file Database.cs.

◆ Analyze() [2/4]

static Task< string[]> Waher.Persistence.Database.Analyze ( XmlWriter  Output,
string  XsltPath,
string  ProgramDataFolder,
bool  ExportData,
bool  Repair 
)
static

Analyzes the database and exports findings to XML.

Parameters
OutputXML Output.
XsltPathOptional XSLT to use to view the output.
ProgramDataFolderProgram data folder. Can be removed from filenames used, when referencing them in the report.
ExportDataIf data in database is to be exported in output.
RepairIf files should be repaired if corruptions are detected.
Returns
Collections with errors found, and repaired if Repair =true.

Definition at line 1342 of file Database.cs.

◆ Analyze() [3/4]

static async Task< string[]> Waher.Persistence.Database.Analyze ( XmlWriter  Output,
string  XsltPath,
string  ProgramDataFolder,
bool  ExportData,
bool  Repair,
ProfilerThread  Thread 
)
static

Analyzes the database and exports findings to XML.

Parameters
OutputXML Output.
XsltPathOptional XSLT to use to view the output.
ProgramDataFolderProgram data folder. Can be removed from filenames used, when referencing them in the report.
ExportDataIf data in database is to be exported in output.
RepairIf files should be repaired if corruptions are detected.
ThreadOptional Profiler thread.
Returns
Collections with errors found, and repaired if Repair =true.

Definition at line 1358 of file Database.cs.

◆ Analyze() [4/4]

static Task< string[]> Waher.Persistence.Database.Analyze ( XmlWriter  Output,
string  XsltPath,
string  ProgramDataFolder,
bool  ExportData,
ProfilerThread  Thread 
)
static

Analyzes the database and exports findings to XML.

Parameters
OutputXML Output.
XsltPathOptional XSLT to use to view the output.
ProgramDataFolderProgram data folder. Can be removed from filenames used, when referencing them in the report.
ExportDataIf data in database is to be exported in output.
ThreadOptional Profiler thread.
Returns
Collections with errors found.

Definition at line 1251 of file Database.cs.

◆ BeginRepair()

static void Waher.Persistence.Database.BeginRepair ( string  Collection)
static

Is called when reparation of a collection is begin.

Parameters
CollectionName of collection.

Definition at line 1411 of file Database.cs.

◆ Clear()

static async Task Waher.Persistence.Database.Clear ( string  CollectionName)
static

Clears a collection of all objects.

Parameters
CollectionNameName of collection to clear.
Returns
Task object for synchronization purposes.

Definition at line 1206 of file Database.cs.

◆ Delete() [1/3]

static async Task Waher.Persistence.Database.Delete ( IEnumerable< object >  Objects)
static

Deletes a collection of objects in the database.

Parameters
ObjectsObjects to insert.

Definition at line 746 of file Database.cs.

◆ Delete() [2/3]

static async Task Waher.Persistence.Database.Delete ( object  Object)
static

Deletes an object in the database.

Parameters
ObjectObject to insert.

Definition at line 717 of file Database.cs.

◆ Delete() [3/3]

static async Task Waher.Persistence.Database.Delete ( params object[]  Objects)
static

Deletes a collection of objects in the database.

Parameters
ObjectsObjects to insert.

Definition at line 732 of file Database.cs.

◆ DeleteLazy() [1/7]

static async Task Waher.Persistence.Database.DeleteLazy ( IEnumerable< object >  Objects)
static

Deletes a collection of objects in the database, if unlocked. If locked, objects will be deleted at next opportunity.

Parameters
ObjectsObjects to insert.

Definition at line 777 of file Database.cs.

◆ DeleteLazy() [2/7]

static async Task Waher.Persistence.Database.DeleteLazy ( object  Object)
static

Deletes an object in the database, if unlocked. If locked, object will be deleted at next opportunity.

Parameters
ObjectObject to insert.

Definition at line 756 of file Database.cs.

◆ DeleteLazy() [3/7]

static async Task Waher.Persistence.Database.DeleteLazy ( params object[]  Objects)
static

Deletes a collection of objects in the database, if unlocked. If locked, objects will be deleted at next opportunity.

Parameters
ObjectsObjects to insert.

Definition at line 765 of file Database.cs.

◆ DeleteLazy() [4/7]

static Task Waher.Persistence.Database.DeleteLazy ( string  Collection,
Filter  Filter,
params string[]  SortOrder 
)
static

Finds objects in a given collection and deletes them in the same atomic operation.

Parameters
CollectionName of collection to search.
FilterOptional filter. Can be null.
SortOrderSort order. Each string represents a field name. By default, sort order is ascending. If descending sort order is desired, prefix the field name by a hyphen (minus) sign.
Returns
Objects found.

Definition at line 1028 of file Database.cs.

◆ DeleteLazy() [5/7]

static Task Waher.Persistence.Database.DeleteLazy ( string  Collection,
int  Offset,
int  MaxCount,
Filter  Filter,
params string[]  SortOrder 
)
static

Finds objects in a given collection and deletes them in the same atomic operation.

Parameters
CollectionName of collection to search.
OffsetResult offset.
MaxCountMaximum number of objects to return.
FilterOptional filter. Can be null.
SortOrderSort order. Each string represents a field name. By default, sort order is ascending. If descending sort order is desired, prefix the field name by a hyphen (minus) sign.
Returns
Objects found.

Definition at line 1043 of file Database.cs.

◆ DeleteLazy() [6/7]

static Task Waher.Persistence.Database.DeleteLazy ( string  Collection,
int  Offset,
int  MaxCount,
params string[]  SortOrder 
)
static

Finds objects in a given collection and deletes them in the same atomic operation.

Parameters
CollectionName of collection to search.
OffsetResult offset.
MaxCountMaximum number of objects to return.
SortOrderSort order. Each string represents a field name. By default, sort order is ascending. If descending sort order is desired, prefix the field name by a hyphen (minus) sign.
Returns
Objects found.

Definition at line 1015 of file Database.cs.

◆ DeleteLazy() [7/7]

static Task Waher.Persistence.Database.DeleteLazy ( string  Collection,
params string[]  SortOrder 
)
static

Finds objects in a given collection and deletes them in the same atomic operation.

Parameters
CollectionName of collection to search.
SortOrderSort order. Each string represents a field name. By default, sort order is ascending. If descending sort order is desired, prefix the field name by a hyphen (minus) sign.
Returns
Objects found.

Definition at line 1001 of file Database.cs.

◆ DeleteLazy< T >() [1/4]

static Task Waher.Persistence.Database.DeleteLazy< T > ( Filter  Filter,
params string[]  SortOrder 
)
static

Finds objects of a given class T and deletes them in the same atomic operation.

Template Parameters
TClass defining how to deserialize objects found.
Parameters
FilterOptional filter. Can be null.
SortOrderSort order. Each string represents a field name. By default, sort order is ascending. If descending sort order is desired, prefix the field name by a hyphen (minus) sign.
Returns
Objects found.
Type Constraints
T :class 

Definition at line 972 of file Database.cs.

◆ DeleteLazy< T >() [2/4]

static Task Waher.Persistence.Database.DeleteLazy< T > ( int  Offset,
int  MaxCount,
Filter  Filter,
params string[]  SortOrder 
)
static

Finds objects of a given class T and deletes them in the same atomic operation.

Template Parameters
TClass defining how to deserialize objects found.
Parameters
OffsetResult offset.
MaxCountMaximum number of objects to return.
FilterOptional filter. Can be null.
SortOrderSort order. Each string represents a field name. By default, sort order is ascending. If descending sort order is desired, prefix the field name by a hyphen (minus) sign.
Returns
Objects found.
Type Constraints
T :class 

Definition at line 988 of file Database.cs.

◆ DeleteLazy< T >() [3/4]

static Task Waher.Persistence.Database.DeleteLazy< T > ( int  Offset,
int  MaxCount,
params string[]  SortOrder 
)
static

Finds objects of a given class T and deletes them in the same atomic operation.

Template Parameters
TClass defining how to deserialize objects found.
Parameters
OffsetResult offset.
MaxCountMaximum number of objects to return.
SortOrderSort order. Each string represents a field name. By default, sort order is ascending. If descending sort order is desired, prefix the field name by a hyphen (minus) sign.
Returns
Objects found.
Type Constraints
T :class 

Definition at line 958 of file Database.cs.

◆ DeleteLazy< T >() [4/4]

static Task Waher.Persistence.Database.DeleteLazy< T > ( params string[]  SortOrder)
static

Finds objects of a given class T and deletes them in the same atomic operation.

Template Parameters
TClass defining how to deserialize objects found.
Parameters
SortOrderSort order. Each string represents a field name. By default, sort order is ascending. If descending sort order is desired, prefix the field name by a hyphen (minus) sign.
Returns
Objects found.
Type Constraints
T :class 

Definition at line 943 of file Database.cs.

◆ DropCollection()

static Task Waher.Persistence.Database.DropCollection ( string  CollectionName)
static

Drops a collection, if it exist.

Parameters
CollectionNameName of collection.

Definition at line 1620 of file Database.cs.

◆ EndBulk()

static Task Waher.Persistence.Database.EndBulk ( )
static

Ends bulk-processing of data. Must be called once for every call to StartBulk.

Definition at line 1494 of file Database.cs.

◆ EndRepair()

static void Waher.Persistence.Database.EndRepair ( string  Collection)
static

Is called when reparation of a collection is ended.

Parameters
CollectionName of collection.

Definition at line 1423 of file Database.cs.

◆ Enumerate() [1/2]

static async Task< PaginatedEnumerator< object > > Waher.Persistence.Database.Enumerate ( string  Collection,
int  PageSize,
Filter  Filter,
params string[]  SortOrder 
)
static

Finds the first page of objects in a given collection.

Parameters
CollectionName of collection to search.
PageSizeNumber of items on a page.
FilterOptional filter. Can be null.
SortOrderSort order. Each string represents a field name. By default, sort order is ascending. If descending sort order is desired, prefix the field name by a hyphen (minus) sign.
Returns
First page of objects.

Definition at line 505 of file Database.cs.

◆ Enumerate() [2/2]

static async Task< PaginatedEnumerator< object > > Waher.Persistence.Database.Enumerate ( string  Collection,
int  PageSize,
params string[]  SortOrder 
)
static

Finds the first page of objects in a given collection.

Parameters
CollectionName of collection to search.
PageSizeNumber of items on a page.
SortOrderSort order. Each string represents a field name. By default, sort order is ascending. If descending sort order is desired, prefix the field name by a hyphen (minus) sign.
Returns
First page of objects.

Definition at line 491 of file Database.cs.

◆ Enumerate< T >() [1/3]

static async Task< PaginatedEnumerator< T > > Waher.Persistence.Database.Enumerate< T > ( int  PageSize,
Filter  Filter,
params string[]  SortOrder 
)
static

Finds the first page of objects of a given class T .

Template Parameters
TClass defining how to deserialize objects found.
Parameters
PageSizeNumber of items on a page.
FilterOptional filter. Can be null.
SortOrderSort order. Each string represents a field name. By default, sort order is ascending. If descending sort order is desired, prefix the field name by a hyphen (minus) sign.
Returns
First page of objects.
Type Constraints
T :class 

Definition at line 476 of file Database.cs.

◆ Enumerate< T >() [2/3]

static async Task< PaginatedEnumerator< T > > Waher.Persistence.Database.Enumerate< T > ( int  PageSize,
params string[]  SortOrder 
)
static

Enumerates objects of a given class T available in the database, by retrieving items from the database in page chunks and looping through them page for page.

Template Parameters
TClass defining how to deserialize objects found.
Parameters
PageSizeNumber of items on a page.
SortOrderSort order. Each string represents a field name. By default, sort order is ascending. If descending sort order is desired, prefix the field name by a hyphen (minus) sign.
Returns
Enumerator of objects matching the search criteria.
Type Constraints
T :class 

Definition at line 461 of file Database.cs.

◆ Enumerate< T >() [3/3]

static async Task< PaginatedEnumerator< T > > Waher.Persistence.Database.Enumerate< T > ( string  Collection,
int  PageSize,
Filter  Filter,
params string[]  SortOrder 
)
static

Finds the first page of objects in a given collection.

Template Parameters
TClass defining how to deserialize objects found.
Parameters
CollectionName of collection to search.
PageSizeNumber of items on a page.
FilterOptional filter. Can be null.
SortOrderSort order. Each string represents a field name. By default, sort order is ascending. If descending sort order is desired, prefix the field name by a hyphen (minus) sign.
Returns
First page of objects.
Type Constraints
T :class 

Definition at line 520 of file Database.cs.

◆ Export() [1/3]

static Task< bool > Waher.Persistence.Database.Export ( IDatabaseExport  Output)
static

Performs an export of the database.

Parameters
OutputDatabase will be output to this interface.
Returns
If export process was completed (true), or terminated by Output (false).

Definition at line 1134 of file Database.cs.

◆ Export() [2/3]

static Task< bool > Waher.Persistence.Database.Export ( IDatabaseExport  Output,
string[]  CollectionNames 
)
static

Performs an export of the database.

Parameters
OutputDatabase will be output to this interface.
CollectionNamesOptional array of collections to export. If null (default), all collections will be exported.
Returns
If export process was completed (true), or terminated by Output (false).

Definition at line 1145 of file Database.cs.

◆ Export() [3/3]

static Task< bool > Waher.Persistence.Database.Export ( IDatabaseExport  Output,
string[]  CollectionNames,
ProfilerThread  Thread 
)
static

Performs an export of the database.

Parameters
OutputDatabase will be output to this interface.
CollectionNamesOptional array of collections to export. If null (default), all collections will be exported.
ThreadOptional Profiler thread.
Returns
If export process was completed (true), or terminated by Output (false).

Definition at line 1157 of file Database.cs.

◆ Find() [1/4]

static Task< IEnumerable< object > > Waher.Persistence.Database.Find ( string  Collection,
Filter  Filter,
params string[]  SortOrder 
)
static

Finds objects in a given collection.

Parameters
CollectionName of collection to search.
FilterOptional filter. Can be null.
SortOrderSort order. Each string represents a field name. By default, sort order is ascending. If descending sort order is desired, prefix the field name by a hyphen (minus) sign.
Returns
Objects found.

Definition at line 260 of file Database.cs.

◆ Find() [2/4]

static Task< IEnumerable< object > > Waher.Persistence.Database.Find ( string  Collection,
int  Offset,
int  MaxCount,
Filter  Filter,
params string[]  SortOrder 
)
static

Finds objects in a given collection.

Parameters
CollectionName of collection to search.
OffsetResult offset.
MaxCountMaximum number of objects to return.
FilterOptional filter. Can be null.
SortOrderSort order. Each string represents a field name. By default, sort order is ascending. If descending sort order is desired, prefix the field name by a hyphen (minus) sign.
Returns
Objects found.

Definition at line 289 of file Database.cs.

◆ Find() [3/4]

static Task< IEnumerable< object > > Waher.Persistence.Database.Find ( string  Collection,
int  Offset,
int  MaxCount,
params string[]  SortOrder 
)
static

Finds objects in a given collection.

Parameters
CollectionName of collection to search.
OffsetResult offset.
MaxCountMaximum number of objects to return.
SortOrderSort order. Each string represents a field name. By default, sort order is ascending. If descending sort order is desired, prefix the field name by a hyphen (minus) sign.
Returns
Objects found.

Definition at line 274 of file Database.cs.

◆ Find() [4/4]

static Task< IEnumerable< object > > Waher.Persistence.Database.Find ( string  Collection,
params string[]  SortOrder 
)
static

Finds objects in a given collection.

Parameters
CollectionName of collection to search.
SortOrderSort order. Each string represents a field name. By default, sort order is ascending. If descending sort order is desired, prefix the field name by a hyphen (minus) sign.
Returns
Objects found.

Definition at line 247 of file Database.cs.

◆ Find< T >() [1/8]

static Task< IEnumerable< T > > Waher.Persistence.Database.Find< T > ( Filter  Filter,
params string[]  SortOrder 
)
static

Finds objects of a given class T .

Template Parameters
TClass defining how to deserialize objects found.
Parameters
FilterOptional filter. Can be null.
SortOrderSort order. Each string represents a field name. By default, sort order is ascending. If descending sort order is desired, prefix the field name by a hyphen (minus) sign.
Returns
Objects found.
Type Constraints
T :class 

Definition at line 203 of file Database.cs.

◆ Find< T >() [2/8]

static Task< IEnumerable< T > > Waher.Persistence.Database.Find< T > ( int  Offset,
int  MaxCount,
Filter  Filter,
params string[]  SortOrder 
)
static

Finds objects of a given class T .

Template Parameters
TClass defining how to deserialize objects found.
Parameters
OffsetResult offset.
MaxCountMaximum number of objects to return.
FilterOptional filter. Can be null.
SortOrderSort order. Each string represents a field name. By default, sort order is ascending. If descending sort order is desired, prefix the field name by a hyphen (minus) sign.
Returns
Objects found.
Type Constraints
T :class 

Definition at line 234 of file Database.cs.

◆ Find< T >() [3/8]

static Task< IEnumerable< T > > Waher.Persistence.Database.Find< T > ( int  Offset,
int  MaxCount,
params string[]  SortOrder 
)
static

Finds objects of a given class T .

Template Parameters
TClass defining how to deserialize objects found.
Parameters
OffsetResult offset.
MaxCountMaximum number of objects to return.
SortOrderSort order. Each string represents a field name. By default, sort order is ascending. If descending sort order is desired, prefix the field name by a hyphen (minus) sign.
Returns
Objects found.
Type Constraints
T :class 

Definition at line 218 of file Database.cs.

◆ Find< T >() [4/8]

static Task< IEnumerable< T > > Waher.Persistence.Database.Find< T > ( params string[]  SortOrder)
static

Finds objects of a given class T .

Template Parameters
TClass defining how to deserialize objects found.
Parameters
SortOrderSort order. Each string represents a field name. By default, sort order is ascending. If descending sort order is desired, prefix the field name by a hyphen (minus) sign.
Returns
Objects found.
Type Constraints
T :class 

Definition at line 189 of file Database.cs.

◆ Find< T >() [5/8]

static Task< IEnumerable< T > > Waher.Persistence.Database.Find< T > ( string  Collection,
Filter  Filter,
params string[]  SortOrder 
)
static

Finds objects in a given collection.

Template Parameters
TClass defining how to deserialize objects found.
Parameters
CollectionName of collection to search.
FilterOptional filter. Can be null.
SortOrderSort order. Each string represents a field name. By default, sort order is ascending. If descending sort order is desired, prefix the field name by a hyphen (minus) sign.
Returns
Objects found.
Type Constraints
T :class 

Definition at line 317 of file Database.cs.

◆ Find< T >() [6/8]

static Task< IEnumerable< T > > Waher.Persistence.Database.Find< T > ( string  Collection,
int  Offset,
int  MaxCount,
Filter  Filter,
params string[]  SortOrder 
)
static

Finds objects in a given collection.

Template Parameters
TClass defining how to deserialize objects found.
Parameters
CollectionName of collection to search.
OffsetResult offset.
MaxCountMaximum number of objects to return.
FilterOptional filter. Can be null.
SortOrderSort order. Each string represents a field name. By default, sort order is ascending. If descending sort order is desired, prefix the field name by a hyphen (minus) sign.
Returns
Objects found.
Type Constraints
T :class 

Definition at line 350 of file Database.cs.

◆ Find< T >() [7/8]

static Task< IEnumerable< T > > Waher.Persistence.Database.Find< T > ( string  Collection,
int  Offset,
int  MaxCount,
params string[]  SortOrder 
)
static

Finds objects in a given collection.

Template Parameters
TClass defining how to deserialize objects found.
Parameters
CollectionName of collection to search.
OffsetResult offset.
MaxCountMaximum number of objects to return.
SortOrderSort order. Each string represents a field name. By default, sort order is ascending. If descending sort order is desired, prefix the field name by a hyphen (minus) sign.
Returns
Objects found.
Type Constraints
T :class 

Definition at line 333 of file Database.cs.

◆ Find< T >() [8/8]

static Task< IEnumerable< T > > Waher.Persistence.Database.Find< T > ( string  Collection,
string[]  SortOrder 
)
static

Finds objects in a given collection.

Template Parameters
TClass defining how to deserialize objects found.
Parameters
CollectionName of collection to search.
SortOrderSort order. Each string represents a field name. By default, sort order is ascending. If descending sort order is desired, prefix the field name by a hyphen (minus) sign.
Returns
Objects found.
Type Constraints
T :class 

Definition at line 302 of file Database.cs.

◆ FindDelete() [1/4]

static Task< IEnumerable< object > > Waher.Persistence.Database.FindDelete ( string  Collection,
Filter  Filter,
params string[]  SortOrder 
)
static

Finds objects in a given collection and deletes them in the same atomic operation.

Parameters
CollectionName of collection to search.
FilterOptional filter. Can be null.
SortOrderSort order. Each string represents a field name. By default, sort order is ascending. If descending sort order is desired, prefix the field name by a hyphen (minus) sign.
Returns
Objects found.

Definition at line 911 of file Database.cs.

◆ FindDelete() [2/4]

static async Task< IEnumerable< object > > Waher.Persistence.Database.FindDelete ( string  Collection,
int  Offset,
int  MaxCount,
Filter  Filter,
params string[]  SortOrder 
)
static

Finds objects in a given collection and deletes them in the same atomic operation.

Parameters
CollectionName of collection to search.
OffsetResult offset.
MaxCountMaximum number of objects to return.
FilterOptional filter. Can be null.
SortOrderSort order. Each string represents a field name. By default, sort order is ascending. If descending sort order is desired, prefix the field name by a hyphen (minus) sign.
Returns
Objects found.

Definition at line 926 of file Database.cs.

◆ FindDelete() [3/4]

static async Task< IEnumerable< object > > Waher.Persistence.Database.FindDelete ( string  Collection,
int  Offset,
int  MaxCount,
params string[]  SortOrder 
)
static

Finds objects in a given collection and deletes them in the same atomic operation.

Parameters
CollectionName of collection to search.
OffsetResult offset.
MaxCountMaximum number of objects to return.
SortOrderSort order. Each string represents a field name. By default, sort order is ascending. If descending sort order is desired, prefix the field name by a hyphen (minus) sign.
Returns
Objects found.

Definition at line 893 of file Database.cs.

◆ FindDelete() [4/4]

static Task< IEnumerable< object > > Waher.Persistence.Database.FindDelete ( string  Collection,
params string[]  SortOrder 
)
static

Finds objects in a given collection and deletes them in the same atomic operation.

Parameters
CollectionName of collection to search.
SortOrderSort order. Each string represents a field name. By default, sort order is ascending. If descending sort order is desired, prefix the field name by a hyphen (minus) sign.
Returns
Objects found.

Definition at line 879 of file Database.cs.

◆ FindDelete< T >() [1/4]

static Task< IEnumerable< T > > Waher.Persistence.Database.FindDelete< T > ( Filter  Filter,
params string[]  SortOrder 
)
static

Finds objects of a given class T and deletes them in the same atomic operation.

Template Parameters
TClass defining how to deserialize objects found.
Parameters
FilterOptional filter. Can be null.
SortOrderSort order. Each string represents a field name. By default, sort order is ascending. If descending sort order is desired, prefix the field name by a hyphen (minus) sign.
Returns
Objects found.
Type Constraints
T :class 

Definition at line 845 of file Database.cs.

◆ FindDelete< T >() [2/4]

static async Task< IEnumerable< T > > Waher.Persistence.Database.FindDelete< T > ( int  Offset,
int  MaxCount,
Filter  Filter,
params string[]  SortOrder 
)
static

Finds objects of a given class T and deletes them in the same atomic operation.

Template Parameters
TClass defining how to deserialize objects found.
Parameters
OffsetResult offset.
MaxCountMaximum number of objects to return.
FilterOptional filter. Can be null.
SortOrderSort order. Each string represents a field name. By default, sort order is ascending. If descending sort order is desired, prefix the field name by a hyphen (minus) sign.
Returns
Objects found.
Type Constraints
T :class 

Definition at line 861 of file Database.cs.

◆ FindDelete< T >() [3/4]

static async Task< IEnumerable< T > > Waher.Persistence.Database.FindDelete< T > ( int  Offset,
int  MaxCount,
params string[]  SortOrder 
)
static

Finds objects of a given class T and deletes them in the same atomic operation.

Template Parameters
TClass defining how to deserialize objects found.
Parameters
OffsetResult offset.
MaxCountMaximum number of objects to return.
SortOrderSort order. Each string represents a field name. By default, sort order is ascending. If descending sort order is desired, prefix the field name by a hyphen (minus) sign.
Returns
Objects found.
Type Constraints
T :class 

Definition at line 826 of file Database.cs.

◆ FindDelete< T >() [4/4]

static Task< IEnumerable< T > > Waher.Persistence.Database.FindDelete< T > ( params string[]  SortOrder)
static

Finds objects of a given class T and deletes them in the same atomic operation.

Template Parameters
TClass defining how to deserialize objects found.
Parameters
SortOrderSort order. Each string represents a field name. By default, sort order is ascending. If descending sort order is desired, prefix the field name by a hyphen (minus) sign.
Returns
Objects found.
Type Constraints
T :class 

Definition at line 811 of file Database.cs.

◆ FindFirst() [1/2]

static Task< IPage< object > > Waher.Persistence.Database.FindFirst ( string  Collection,
int  PageSize,
Filter  Filter,
params string[]  SortOrder 
)
static

Finds the first page of objects in a given collection.

Parameters
CollectionName of collection to search.
PageSizeNumber of items on a page.
FilterOptional filter. Can be null.
SortOrderSort order. Each string represents a field name. By default, sort order is ascending. If descending sort order is desired, prefix the field name by a hyphen (minus) sign.
Returns
First page of objects.

Definition at line 408 of file Database.cs.

◆ FindFirst() [2/2]

static Task< IPage< object > > Waher.Persistence.Database.FindFirst ( string  Collection,
int  PageSize,
params string[]  SortOrder 
)
static

Finds the first page of objects in a given collection.

Parameters
CollectionName of collection to search.
PageSizeNumber of items on a page.
SortOrderSort order. Each string represents a field name. By default, sort order is ascending. If descending sort order is desired, prefix the field name by a hyphen (minus) sign.
Returns
First page of objects.

Definition at line 394 of file Database.cs.

◆ FindFirst< T >() [1/3]

static Task< IPage< T > > Waher.Persistence.Database.FindFirst< T > ( int  PageSize,
Filter  Filter,
params string[]  SortOrder 
)
static

Finds the first page of objects of a given class T .

Template Parameters
TClass defining how to deserialize objects found.
Parameters
PageSizeNumber of items on a page.
FilterOptional filter. Can be null.
SortOrderSort order. Each string represents a field name. By default, sort order is ascending. If descending sort order is desired, prefix the field name by a hyphen (minus) sign.
Returns
First page of objects.
Type Constraints
T :class 

Definition at line 379 of file Database.cs.

◆ FindFirst< T >() [2/3]

static Task< IPage< T > > Waher.Persistence.Database.FindFirst< T > ( int  PageSize,
params string[]  SortOrder 
)
static

Finds the first page of objects of a given class T .

Template Parameters
TClass defining how to deserialize objects found.
Parameters
PageSizeNumber of items on a page.
SortOrderSort order. Each string represents a field name. By default, sort order is ascending. If descending sort order is desired, prefix the field name by a hyphen (minus) sign.
Returns
First page of objects.
Type Constraints
T :class 

Definition at line 364 of file Database.cs.

◆ FindFirst< T >() [3/3]

static Task< IPage< T > > Waher.Persistence.Database.FindFirst< T > ( string  Collection,
int  PageSize,
Filter  Filter,
params string[]  SortOrder 
)
static

Finds the first page of objects in a given collection.

Template Parameters
TClass defining how to deserialize objects found.
Parameters
CollectionName of collection to search.
PageSizeNumber of items on a page.
FilterOptional filter. Can be null.
SortOrderSort order. Each string represents a field name. By default, sort order is ascending. If descending sort order is desired, prefix the field name by a hyphen (minus) sign.
Returns
First page of objects.
Type Constraints
T :class 

Definition at line 423 of file Database.cs.

◆ FindFirstDeleteRest< T >() [1/2]

static async Task< T > Waher.Persistence.Database.FindFirstDeleteRest< T > ( Filter  Filter,
params string[]  SortOrder 
)
static

Finds the first object of a given class T and deletes the rest.

Template Parameters
TClass defining how to deserialize objects found.
Parameters
FilterOptional filter. Can be null.
SortOrderSort order. Each string represents a field name. By default, sort order is ascending. If descending sort order is desired, prefix the field name by a hyphen (minus) sign.
Returns
First Object, if found, null otherwise.
Exceptions
TimeoutExceptionThrown if a response is not returned from the database within the given number of milliseconds.
Type Constraints
T :class 

Definition at line 578 of file Database.cs.

◆ FindFirstDeleteRest< T >() [2/2]

static async Task< T > Waher.Persistence.Database.FindFirstDeleteRest< T > ( params string[]  SortOrder)
static

Finds the first object of a given class T and deletes the rest.

Template Parameters
TClass defining how to deserialize objects found.
Parameters
SortOrderSort order. Each string represents a field name. By default, sort order is ascending. If descending sort order is desired, prefix the field name by a hyphen (minus) sign.
Returns
First Object, if found, null otherwise.
Exceptions
TimeoutExceptionThrown if a response is not returned from the database within the given number of milliseconds.
Type Constraints
T :class 

Definition at line 534 of file Database.cs.

◆ FindFirstIgnoreRest< T >() [1/2]

static async Task< T > Waher.Persistence.Database.FindFirstIgnoreRest< T > ( Filter  Filter,
params string[]  SortOrder 
)
static

Finds the first object of a given class T and ignores the rest.

Template Parameters
TClass defining how to deserialize objects found.
Parameters
FilterOptional filter. Can be null.
SortOrderSort order. Each string represents a field name. By default, sort order is ascending. If descending sort order is desired, prefix the field name by a hyphen (minus) sign.
Returns
Objects found.
Exceptions
TimeoutExceptionThrown if a response is not returned from the database within the given number of milliseconds.
Type Constraints
T :class 

Definition at line 616 of file Database.cs.

◆ FindFirstIgnoreRest< T >() [2/2]

static async Task< T > Waher.Persistence.Database.FindFirstIgnoreRest< T > ( params string[]  SortOrder)
static

Finds the first object of a given class T and ignores the rest.

Template Parameters
TClass defining how to deserialize objects found.
Parameters
SortOrderSort order. Each string represents a field name. By default, sort order is ascending. If descending sort order is desired, prefix the field name by a hyphen (minus) sign.
Returns
Objects found.
Exceptions
TimeoutExceptionThrown if a response is not returned from the database within the given number of milliseconds.
Type Constraints
T :class 

Definition at line 592 of file Database.cs.

◆ FindNext()

static Task< IPage< object > > Waher.Persistence.Database.FindNext ( IPage< object >  Page)
static

Finds the next page of objects in a given collection.

Parameters
PagePage reference.
Returns
Next page, directly following Page .

Definition at line 446 of file Database.cs.

◆ FindNext< T >()

static Task< IPage< T > > Waher.Persistence.Database.FindNext< T > ( IPage< T >  Page)
static

Finds the next page of objects of a given class T .

Template Parameters
TClass defining how to deserialize objects found.
Parameters
PagePage reference.
Returns
Next page, directly following Page .
Type Constraints
T :class 

Definition at line 435 of file Database.cs.

◆ FlagForRepair()

static Exception Waher.Persistence.Database.FlagForRepair ( string  Collection,
string  Reason 
)
static

Flags a collection for repairing.

Parameters
CollectionCollection
ReasonReason for flagging collection.

Definition at line 1436 of file Database.cs.

◆ Generalize()

static Task< GenericObject > Waher.Persistence.Database.Generalize ( object  Object)
static

Creates a generalized representation of an object.

Parameters
ObjectObject
Returns
Generalized representation.

Definition at line 1678 of file Database.cs.

◆ GetCollection() [1/2]

static Task< string > Waher.Persistence.Database.GetCollection ( Object  Object)
static

Gets the collection corresponding to a given object.

Parameters
ObjectObject
Returns
Collection name.

Definition at line 1580 of file Database.cs.

◆ GetCollection() [2/2]

static Task< string > Waher.Persistence.Database.GetCollection ( Type  Type)
static

Gets the collection corresponding to a given type.

Parameters
TypeType
Returns
Collection name.

Definition at line 1570 of file Database.cs.

◆ GetCollections()

static Task< string[]> Waher.Persistence.Database.GetCollections ( )
static

Gets an array of available collections.

Returns
Array of collections.

Definition at line 1560 of file Database.cs.

◆ GetDictionaries()

static Task< string[]> Waher.Persistence.Database.GetDictionaries ( )
static

Gets an array of available dictionary collections.

Returns
Array of dictionary collections.

Definition at line 1551 of file Database.cs.

◆ GetDictionary()

static Task< IPersistentDictionary > Waher.Persistence.Database.GetDictionary ( string  Collection)
static

Gets a persistent dictionary containing objects in a collection.

Parameters
CollectionCollection Name
Returns
Persistent dictionary

Definition at line 1542 of file Database.cs.

◆ GetExcludedCollections()

static string[] Waher.Persistence.Database.GetExcludedCollections ( )
static

Gets an array of collections that should be excluded from backups.

Returns
Array of excluded collections.

Definition at line 1697 of file Database.cs.

◆ GetFlaggedCollectionNames()

static string[] Waher.Persistence.Database.GetFlaggedCollectionNames ( )
static

Gets the names of the collections that have been flagged as possibly corrupt.

Returns
Names of collections that have been flagged.

Definition at line 1394 of file Database.cs.

◆ GetLabels()

static Task< string[]> Waher.Persistence.Database.GetLabels ( string  Collection)
static

Gets an array of available labels for a collection.

Returns
Array of labels.

Definition at line 1601 of file Database.cs.

◆ Insert() [1/3]

static async Task Waher.Persistence.Database.Insert ( IEnumerable< object >  Objects)
static

Inserts a set of objects into the default collection of the database.

Parameters
ObjectsObjects to insert.

Definition at line 146 of file Database.cs.

◆ Insert() [2/3]

static async Task Waher.Persistence.Database.Insert ( object  Object)
static

Inserts an object into the default collection of the database.

Parameters
ObjectObject to insert.

Definition at line 95 of file Database.cs.

◆ Insert() [3/3]

static async Task Waher.Persistence.Database.Insert ( params object[]  Objects)
static

Inserts a set of objects into the default collection of the database.

Parameters
ObjectsObjects to insert.

Definition at line 132 of file Database.cs.

◆ InsertLazy() [1/3]

static async Task Waher.Persistence.Database.InsertLazy ( IEnumerable< object >  Objects)
static

Inserts an object into the database, if unlocked. If locked, object will be inserted at next opportunity.

Parameters
ObjectsObjects to insert.

Definition at line 177 of file Database.cs.

◆ InsertLazy() [2/3]

static async Task Waher.Persistence.Database.InsertLazy ( object  Object)
static

Inserts an object into the database, if unlocked. If locked, object will be inserted at next opportunity.

Parameters
ObjectObject to insert.

Definition at line 156 of file Database.cs.

◆ InsertLazy() [3/3]

static async Task Waher.Persistence.Database.InsertLazy ( params object[]  Objects)
static

Inserts an object into the database, if unlocked. If locked, object will be inserted at next opportunity.

Parameters
ObjectsObjects to insert.

Definition at line 165 of file Database.cs.

◆ IsLabel()

static Task< bool > Waher.Persistence.Database.IsLabel ( string  Collection,
string  Label 
)
static

Checks if a string is a label in a given collection.

Parameters
CollectionName of collection.
LabelLabel to check.
Returns
If Label is a label in the collection defined by Collection .

Definition at line 1592 of file Database.cs.

◆ Iterate< T >() [1/3]

static Task Waher.Persistence.Database.Iterate< T > ( IDatabaseIteration< T >  Recipient)
static

Performs an iteration of contents of the entire database.

Template Parameters
TType of objects to iterate.
Parameters
RecipientRecipient of iterated objects.
Returns
Task object for synchronization purposes.
Type Constraints
T :class 

Definition at line 1168 of file Database.cs.

◆ Iterate< T >() [2/3]

static Task Waher.Persistence.Database.Iterate< T > ( IDatabaseIteration< T >  Recipient,
string[]  CollectionNames 
)
static

Performs an iteration of contents of the entire database.

Template Parameters
TType of objects to iterate.
Parameters
RecipientRecipient of iterated objects.
CollectionNamesOptional array of collections to export. If null, all collections will be exported.
Returns
Task object for synchronization purposes.
Type Constraints
T :class 

Definition at line 1181 of file Database.cs.

◆ Iterate< T >() [3/3]

static Task Waher.Persistence.Database.Iterate< T > ( IDatabaseIteration< T >  Recipient,
string[]  CollectionNames,
ProfilerThread  Thread 
)
static

Performs an iteration of contents of the entire database.

Template Parameters
TType of objects to iterate.
Parameters
RecipientRecipient of iterated objects.
CollectionNamesOptional array of collections to export. If null, all collections will be exported.
ThreadOptional Profiler thread.
Returns
Task object for synchronization purposes.
Type Constraints
T :class 

Definition at line 1195 of file Database.cs.

◆ LoadObject()

static async Task< object > Waher.Persistence.Database.LoadObject ( string  CollectionName,
object  ObjectId 
)
static

Loads an object given its Object ID ObjectId and its collection name CollectionName .

Parameters
CollectionNameName of collection in which the object resides.
ObjectIdObject ID
Returns
Loaded object.

Definition at line 1121 of file Database.cs.

◆ LoadObject< T >() [1/2]

static async Task< T > Waher.Persistence.Database.LoadObject< T > ( object  ObjectId)
static

Loads an object given its Object ID ObjectId and its base type T .

Template Parameters
TBase type.
Parameters
ObjectIdObject ID
Returns
Loaded object.
Type Constraints
T :class 

Definition at line 1090 of file Database.cs.

◆ LoadObject< T >() [2/2]

static async Task< T > Waher.Persistence.Database.LoadObject< T > ( string  CollectionName,
object  ObjectId 
)
static

Loads an object given its Object ID ObjectId and its collection name CollectionName .

Template Parameters
TBase type.
Parameters
CollectionNameName of collection in which the object resides.
ObjectIdObject ID
Returns
Loaded object.
Type Constraints
T :class 

Definition at line 1106 of file Database.cs.

◆ Register() [1/2]

static void Waher.Persistence.Database.Register ( IDatabaseProvider  DatabaseProvider)
static

Registers a database provider for use from the static Database class, throughout the lifetime of the application.

Note: Only one database provider can be registered.

Parameters
DatabaseProviderDatabase provider to use.

Definition at line 31 of file Database.cs.

◆ Register() [2/2]

static void Waher.Persistence.Database.Register ( IDatabaseProvider  DatabaseProvider,
bool  Lock 
)
static

Registers a database provider for use from the static Database class, throughout the lifetime of the application.

Note: Only one database provider can be registered.

Parameters
DatabaseProviderDatabase provider to use.
LockIf the database provider should be locked for the rest of the running time of the application.

Definition at line 44 of file Database.cs.

◆ RemoveIndex()

static Task Waher.Persistence.Database.RemoveIndex ( string  CollectionName,
string[]  FieldNames 
)
static

Removes an index from a collection, if one exist.

Parameters
CollectionNameName of collection.
FieldNamesSort order. Each string represents a field name. By default, sort order is ascending. If descending sort order is desired, prefix the field name by a hyphen (minus) sign.

Definition at line 1478 of file Database.cs.

◆ Repair() [1/2]

static Task< string[]> Waher.Persistence.Database.Repair ( XmlWriter  Output,
string  XsltPath,
string  ProgramDataFolder,
bool  ExportData 
)
static

Analyzes the database and repairs it if necessary. Results are exported to XML.

Parameters
OutputXML Output.
XsltPathOptional XSLT to use to view the output.
ProgramDataFolderProgram data folder. Can be removed from filenames used, when referencing them in the report.
ExportDataIf data in database is to be exported in output.
Returns
Collections with errors found and repaired.

Definition at line 1265 of file Database.cs.

◆ Repair() [2/2]

static async Task< string[]> Waher.Persistence.Database.Repair ( XmlWriter  Output,
string  XsltPath,
string  ProgramDataFolder,
bool  ExportData,
ProfilerThread  Thread 
)
static

Analyzes the database and repairs it if necessary. Results are exported to XML.

Parameters
OutputXML Output.
XsltPathOptional XSLT to use to view the output.
ProgramDataFolderProgram data folder. Can be removed from filenames used, when referencing them in the report.
ExportDataIf data in database is to be exported in output.
ThreadOptional Profiler thread.
Returns
Collections with errors found and repaired.

Definition at line 1279 of file Database.cs.

◆ Specialize()

static Task< object > Waher.Persistence.Database.Specialize ( GenericObject  Object)
static

Creates a specialized representation of a generic object.

Parameters
ObjectGeneric object.
Returns
Specialized representation.

Definition at line 1688 of file Database.cs.

◆ StartBulk()

static Task Waher.Persistence.Database.StartBulk ( )
static

Starts bulk-proccessing of data. Must be followed by a call to EndBulk.

Definition at line 1486 of file Database.cs.

◆ ToCaseInsensitiveStringArray()

static CaseInsensitiveString[] Waher.Persistence.Database.ToCaseInsensitiveStringArray ( this string[]  A)
static

Converts a case insensitive string array to a normal string array.

Parameters
ACase insensitive string array-
Returns
Normal string array.

Definition at line 1523 of file Database.cs.

◆ ToStringArray()

static string[] Waher.Persistence.Database.ToStringArray ( this CaseInsensitiveString[]  A)
static

Converts a case insensitive string array to a normal string array.

Parameters
ACase insensitive string array-
Returns
Normal string array.

Definition at line 1504 of file Database.cs.

◆ TryGetObjectId()

static Task< object > Waher.Persistence.Database.TryGetObjectId ( object  Object)
static

Tries to get the Object ID of an object, if it exists.

Parameters
ObjectObject whose Object ID is of interest.
Returns
Object ID, if found, null otherwise.

Definition at line 1611 of file Database.cs.

◆ TryLoadObject()

static Task< object > Waher.Persistence.Database.TryLoadObject ( string  CollectionName,
object  ObjectId 
)
static

Tries to load an object given its Object ID ObjectId and its collection name CollectionName .

Parameters
CollectionNameName of collection in which the object resides.
ObjectIdObject ID
Returns
Loaded object, or null if not found.

Definition at line 1079 of file Database.cs.

◆ TryLoadObject< T >() [1/2]

static Task< T > Waher.Persistence.Database.TryLoadObject< T > ( object  ObjectId)
static

Tries to load an object given its Object ID ObjectId and its class type T .

Template Parameters
TBase type.
Parameters
ObjectIdObject ID
Returns
Loaded object, or null if not found.
Type Constraints
T :class 

Definition at line 1054 of file Database.cs.

◆ TryLoadObject< T >() [2/2]

static Task< T > Waher.Persistence.Database.TryLoadObject< T > ( string  CollectionName,
object  ObjectId 
)
static

Tries to load an object given its Object ID ObjectId and its class type T .

Template Parameters
TBase type.
Parameters
CollectionNameName of collection in which the object resides.
ObjectIdObject ID
Returns
Loaded object, or null if not found.
Type Constraints
T :class 

Definition at line 1067 of file Database.cs.

◆ Update() [1/3]

static async Task Waher.Persistence.Database.Update ( IEnumerable< object >  Objects)
static

Updates a collection of objects in the database.

Parameters
ObjectsObjects to insert.

Definition at line 677 of file Database.cs.

◆ Update() [2/3]

static async Task Waher.Persistence.Database.Update ( object  Object)
static

Updates an object in the database.

Parameters
ObjectObject to insert.

Definition at line 626 of file Database.cs.

◆ Update() [3/3]

static async Task Waher.Persistence.Database.Update ( params object[]  Objects)
static

Updates a collection of objects in the database.

Parameters
ObjectsObjects to insert.

Definition at line 663 of file Database.cs.

◆ UpdateLazy() [1/3]

static async Task Waher.Persistence.Database.UpdateLazy ( IEnumerable< object >  Objects)
static

Updates a collection of objects in the database, if unlocked. If locked, objects will be updated at next opportunity.

Parameters
ObjectsObjects to insert.

Definition at line 708 of file Database.cs.

◆ UpdateLazy() [2/3]

static async Task Waher.Persistence.Database.UpdateLazy ( object  Object)
static

Updates an object in the database, if unlocked. If locked, object will be updated at next opportunity.

Parameters
ObjectObject to insert.

Definition at line 687 of file Database.cs.

◆ UpdateLazy() [3/3]

static async Task Waher.Persistence.Database.UpdateLazy ( params object[]  Objects)
static

Updates a collection of objects in the database, if unlocked. If locked, objects will be updated at next opportunity.

Parameters
ObjectsObjects to insert.

Definition at line 696 of file Database.cs.

◆ WildcardToRegex()

static string Waher.Persistence.Database.WildcardToRegex ( string  s,
string  Wildcard 
)
static

Converts a wildcard string to a regular expression string.

Parameters
sString
WildcardWildcard
Returns
Regular expression

Definition at line 1631 of file Database.cs.

Property Documentation

◆ HasProvider

bool Waher.Persistence.Database.HasProvider
staticget

If a database provider is registered.

Definition at line 78 of file Database.cs.

◆ Locked

bool Waher.Persistence.Database.Locked
staticget

If the datbase provider has been locked for the rest of the run-time of the application.

Definition at line 86 of file Database.cs.

◆ Provider

IDatabaseProvider Waher.Persistence.Database.Provider
staticget

Registered database provider.

Definition at line 56 of file Database.cs.

Event Documentation

◆ CollectionCleared

CollectionEventHandler Waher.Persistence.Database.CollectionCleared = null
static

Event raised when a collection has been cleared.

Definition at line 1227 of file Database.cs.

◆ CollectionRepaired

CollectionRepairedEventHandler Waher.Persistence.Database.CollectionRepaired = null
static

Event raised when a collection has been repaired.

Definition at line 1331 of file Database.cs.

◆ ObjectDeleted

ObjectEventHandler Waher.Persistence.Database.ObjectDeleted = null
static

Event raised when an object has been deleted.

Definition at line 726 of file Database.cs.

◆ ObjectInserted

ObjectEventHandler Waher.Persistence.Database.ObjectInserted = null
static

Event raised when an object has been inserted.

Definition at line 126 of file Database.cs.

◆ ObjectUpdated

ObjectEventHandler Waher.Persistence.Database.ObjectUpdated = null
static

Event raised when an object has been updated.

Definition at line 657 of file Database.cs.


The documentation for this class was generated from the following file: