2using System.Collections.Generic;
4using System.Threading.Tasks;
20 private static readonly Dictionary<string, Dictionary<string, FlagSource>> toRepair =
new Dictionary<string, Dictionary<string, FlagSource>>();
22 private static bool locked =
false;
46 if (!(provider is
null) && locked)
47 throw new Exception(
"A database provider is already registered.");
49 provider = DatabaseProvider;
60 if (!(provider is
null))
63 throw new Exception(
"A database provider has not been registered.");
88 get {
return locked; }
95 public async
static Task
Insert(
object Object)
98 RaiseInserted(Object);
101 private static void RaiseInserted(
object Object)
117 private static void RaiseInserted(IEnumerable<object> Objects)
119 foreach (
object Object
in Objects)
120 RaiseInserted(Object);
132 public async
static Task
Insert(params
object[] Objects)
134 if (Objects.Length == 1)
139 RaiseInserted(Objects);
146 public async
static Task
Insert(IEnumerable<object> Objects)
149 RaiseInserted(Objects);
167 if (Objects.Length == 1)
177 public static async Task
InsertLazy(IEnumerable<object> Objects)
189 public static Task<IEnumerable<T>>
Find<T>(params
string[] SortOrder)
218 public static Task<IEnumerable<T>>
Find<T>(
int Offset,
int MaxCount, params
string[] SortOrder)
234 public static Task<IEnumerable<T>>
Find<T>(
int Offset,
int MaxCount,
Filter Filter, params
string[] SortOrder)
247 public static Task<IEnumerable<object>>
Find(
string Collection, params
string[] SortOrder)
249 return Provider.
Find(Collection, 0,
int.MaxValue, SortOrder);
260 public static Task<IEnumerable<object>>
Find(
string Collection,
Filter Filter, params
string[] SortOrder)
274 public static Task<IEnumerable<object>>
Find(
string Collection,
int Offset,
int MaxCount, params
string[] SortOrder)
276 return Provider.
Find(Collection, Offset, MaxCount, SortOrder);
289 public static Task<IEnumerable<object>>
Find(
string Collection,
int Offset,
int MaxCount,
Filter Filter, params
string[] SortOrder)
302 public static Task<IEnumerable<T>>
Find<T>(
string Collection,
string[] SortOrder)
305 return Provider.
Find<T>(Collection, 0,
int.MaxValue,
null, SortOrder);
333 public static Task<IEnumerable<T>>
Find<T>(
string Collection,
int Offset,
int MaxCount, params
string[] SortOrder)
336 return Provider.
Find<T>(Collection, Offset, MaxCount,
null, SortOrder);
350 public static Task<IEnumerable<T>>
Find<T>(
string Collection,
int Offset,
int MaxCount,
Filter Filter, params
string[] SortOrder)
364 public static Task<IPage<T>>
FindFirst<T>(
int PageSize, params
string[] SortOrder)
394 public static Task<IPage<object>>
FindFirst(
string Collection,
int PageSize, params
string[] SortOrder)
408 public static Task<IPage<object>>
FindFirst(
string Collection,
int PageSize,
Filter Filter, params
string[] SortOrder)
461 public static async Task<PaginatedEnumerator<T>>
Enumerate<T>(
int PageSize, params
string[] SortOrder)
491 public static async Task<PaginatedEnumerator<object>>
Enumerate(
string Collection,
int PageSize, params
string[] SortOrder)
505 public static async Task<PaginatedEnumerator<object>>
Enumerate(
string Collection,
int PageSize,
Filter Filter, params
string[] SortOrder)
520 public static async Task<PaginatedEnumerator<T>>
Enumerate<T>(
string Collection,
int PageSize,
Filter Filter, params
string[] SortOrder)
537 return await FirstDeleteRest(await
Provider.
Find<T>(0,
int.MaxValue, SortOrder));
540 private static async Task<T> FirstDeleteRest<T>(IEnumerable<T> Set)
546 foreach (T Obj
in Set)
559 catch (KeyNotFoundException)
581 return await FirstDeleteRest(await
Provider.
Find<T>(0,
int.MaxValue,
Filter, SortOrder));
595 return FirstIgnoreRest(await
Provider.
Find<T>(0, 1, SortOrder));
598 private static T FirstIgnoreRest<T>(IEnumerable<T> Set)
601 foreach (T Obj
in Set)
626 public async
static Task
Update(
object Object)
629 RaiseUpdated(Object);
632 private static void RaiseUpdated(
object Object)
648 private static void RaiseUpdated(IEnumerable<object> Objects)
650 foreach (
object Object
in Objects)
651 RaiseUpdated(Object);
663 public async
static Task
Update(params
object[] Objects)
665 if (Objects.Length == 1)
670 RaiseUpdated(Objects);
677 public async
static Task
Update(IEnumerable<object> Objects)
680 RaiseUpdated(Objects);
698 if (Objects.Length == 1)
708 public async
static Task
UpdateLazy(IEnumerable<object> Objects)
717 public async
static Task
Delete(
object Object)
720 RaiseDeleted(Object);
732 public async
static Task
Delete(params
object[] Objects)
734 if (Objects.Length == 1)
739 RaiseDeleted(Objects);
746 public async
static Task
Delete(IEnumerable<object> Objects)
749 RaiseDeleted(Objects);
767 if (Objects.Length == 1)
777 public async
static Task
DeleteLazy(IEnumerable<object> Objects)
782 private static void RaiseDeleted(
object Object)
798 private static void RaiseDeleted(IEnumerable<object> Objects)
800 foreach (
object Object
in Objects)
801 RaiseDeleted(Object);
826 public static async Task<IEnumerable<T>>
FindDelete<T>(
int Offset,
int MaxCount, params
string[] SortOrder)
831 foreach (T Object
in Result)
832 RaiseDeleted(Object);
866 foreach (T Object
in Result)
867 RaiseDeleted(Object);
879 public static Task<IEnumerable<object>>
FindDelete(
string Collection, params
string[] SortOrder)
881 return FindDelete(Collection, 0,
int.MaxValue, SortOrder);
893 public static async Task<IEnumerable<object>>
FindDelete(
string Collection,
int Offset,
int MaxCount, params
string[] SortOrder)
895 IEnumerable<object> Result = await
Provider.
FindDelete(Collection, Offset, MaxCount, SortOrder);
897 foreach (
object Object
in Result)
898 RaiseDeleted(Object);
926 public static async Task<IEnumerable<object>>
FindDelete(
string Collection,
int Offset,
int MaxCount,
Filter Filter, params
string[] SortOrder)
930 foreach (
object Object
in Result)
931 RaiseDeleted(Object);
958 public static Task
DeleteLazy<T>(
int Offset,
int MaxCount, params
string[] SortOrder)
1001 public static Task
DeleteLazy(
string Collection, params
string[] SortOrder)
1003 return DeleteLazy(Collection, 0,
int.MaxValue, SortOrder);
1015 public static Task
DeleteLazy(
string Collection,
int Offset,
int MaxCount, params
string[] SortOrder)
1079 public static Task<object>
TryLoadObject(
string CollectionName,
object ObjectId)
1094 ??
throw new KeyNotFoundException(
"Object not found.");
1106 public async
static Task<T>
LoadObject<T>(
string CollectionName,
object ObjectId)
1110 ??
throw new KeyNotFoundException(
"Object not found.");
1121 public static async Task<object>
LoadObject(
string CollectionName,
object ObjectId)
1124 ??
throw new KeyNotFoundException(
"Object not found.");
1136 return Export(Output,
null);
1171 return Iterate(Recipient,
null);
1184 return Provider.Iterate(Recipient, CollectionNames);
1198 return Provider.Iterate(Recipient, CollectionNames, Thread);
1206 public async
static Task
Clear(
string CollectionName)
1237 public static Task<string[]>
Analyze(XmlWriter Output,
string XsltPath,
string ProgramDataFolder,
bool ExportData)
1239 return Provider.
Analyze(Output, XsltPath, ProgramDataFolder, ExportData);
1251 public static Task<string[]>
Analyze(XmlWriter Output,
string XsltPath,
string ProgramDataFolder,
bool ExportData,
1254 return Provider.
Analyze(Output, XsltPath, ProgramDataFolder, ExportData, Thread);
1265 public static Task<string[]>
Repair(XmlWriter Output,
string XsltPath,
string ProgramDataFolder,
bool ExportData)
1267 return Repair(Output, XsltPath, ProgramDataFolder, ExportData,
null);
1279 public async
static Task<string[]>
Repair(XmlWriter Output,
string XsltPath,
string ProgramDataFolder,
bool ExportData,
1282 KeyValuePair<string, Dictionary<string, FlagSource>>[] Flagged = GetFlaggedCollections();
1284 string[] Result = await
Provider.
Repair(Output, XsltPath, ProgramDataFolder, ExportData, Thread);
1286 if (Result.Length > 0)
1287 RaiseRepaired(Result, Flagged);
1292 private static void RaiseRepaired(
string[] Collections, KeyValuePair<
string, Dictionary<string, FlagSource>>[] Flagged)
1299 foreach (
string Collection
in Collections)
1301 FlaggedCollection =
null;
1303 if (!(Flagged is
null))
1305 foreach (KeyValuePair<
string, Dictionary<string, FlagSource>> Rec
in Flagged)
1307 if (Rec.Key == Collection)
1309 FlaggedCollection =
new FlagSource[Rec.Value.Count];
1310 Rec.Value.Values.CopyTo(FlaggedCollection, 0);
1342 public static Task<string[]>
Analyze(XmlWriter Output,
string XsltPath,
string ProgramDataFolder,
bool ExportData,
1345 return Analyze(Output, XsltPath, ProgramDataFolder, ExportData,
Repair,
null);
1358 public async
static Task<string[]>
Analyze(XmlWriter Output,
string XsltPath,
string ProgramDataFolder,
bool ExportData,
1361 KeyValuePair<string, Dictionary<string, FlagSource>>[] Flagged = GetFlaggedCollections();
1363 string[] Result = await
Provider.
Analyze(Output, XsltPath, ProgramDataFolder, ExportData,
Repair, Thread);
1365 if (
Repair && Result.Length > 0)
1366 RaiseRepaired(Result, Flagged);
1371 private static KeyValuePair<string, Dictionary<string, FlagSource>>[] GetFlaggedCollections()
1373 KeyValuePair<string, Dictionary<string, FlagSource>>[] Flagged;
1378 Flagged =
new KeyValuePair<string, Dictionary<string, FlagSource>>[toRepair.Count];
1381 foreach (KeyValuePair<
string, Dictionary<string, FlagSource>> P
in toRepair)
1400 Result =
new string[toRepair.Count];
1401 toRepair.Keys.CopyTo(Result, 0);
1415 toRepair[Collection] =
null;
1427 toRepair.Remove(Collection);
1440 string Key = Reason +
" | " + StackTrace;
1444 if (toRepair.TryGetValue(Collection, out Dictionary<string, FlagSource> PerStackTrace))
1446 if (!(PerStackTrace is
null))
1451 PerStackTrace[Key] =
new FlagSource(Reason, StackTrace, 1);
1455 toRepair[Collection] =
new Dictionary<string, FlagSource>() { { Key,
new FlagSource(Reason, StackTrace, 1) } };
1467 public static Task
AddIndex(
string CollectionName,
string[] FieldNames)
1478 public static Task
RemoveIndex(
string CollectionName,
string[] FieldNames)
1510 string[] B =
new string[c];
1512 for (i = 0; i < c; i++)
1531 for (i = 0; i < c; i++)
1592 public static Task<bool>
IsLabel(
string Collection,
string Label)
1633 string[] Parts = s.Split(
new string[] { Wildcard }, StringSplitOptions.None);
1634 StringBuilder RegEx =
new StringBuilder();
1638 foreach (
string Part
in Parts)
1649 j = Part.IndexOfAny(regexSpecialCharaters, i);
1652 RegEx.Append(Part.Substring(i));
1658 RegEx.Append(Part.Substring(i, j - i));
1661 RegEx.Append(Part[j]);
1668 return RegEx.ToString();
1671 private static readonly
char[] regexSpecialCharaters =
new char[] {
'\\',
'^',
'$',
'{',
'}',
'[',
']',
'(',
')',
'.',
'*',
'+',
'?',
'|',
'<',
'>',
'-',
'&' };
Static class managing the application event log. Applications and services log events on this static ...
static string CleanStackTrace(string StackTrace)
Cleans a Stack Trace string, removing entries from the asynchronous execution model,...
Represents a case-insensitive string.
int Length
Gets the number of characters in the current CaseInsensitiveString object.
Event arguments for collection events.
Event arguments for collection repaired events.
Static interface for database persistence. In order to work, a database provider has to be assigned t...
static Task< string[]> GetDictionaries()
Gets an array of available dictionary collections.
static Task< IEnumerable< object > > FindDelete(string Collection, params string[] SortOrder)
Finds objects in a given collection and deletes them in the same atomic operation.
static Task< string[]> Analyze(XmlWriter Output, string XsltPath, string ProgramDataFolder, bool ExportData, ProfilerThread Thread)
Analyzes the database and exports findings to XML.
static Task< T > TryLoadObject< T >(object ObjectId)
Tries to load an object given its Object ID ObjectId and its class type T .
static ObjectEventHandler ObjectUpdated
Event raised when an object has been updated.
static Task< string > GetCollection(Object Object)
Gets the collection corresponding to a given object.
static Task< IEnumerable< T > > Find< T >(params string[] SortOrder)
Finds objects of a given class T .
static Task DeleteLazy(string Collection, Filter Filter, params string[] SortOrder)
Finds objects in a given collection and deletes them in the same atomic operation.
static Task< IPage< T > > FindNext< T >(IPage< T > Page)
Finds the next page of objects of a given class T .
static Task< bool > Export(IDatabaseExport Output, string[] CollectionNames)
Performs an export of the database.
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.
static Task DeleteLazy(string Collection, params string[] SortOrder)
Finds objects in a given collection and deletes them in the same atomic operation.
static async Task DeleteLazy(object Object)
Deletes an object in the database, if unlocked. If locked, object will be deleted at next opportunity...
static Task RemoveIndex(string CollectionName, string[] FieldNames)
Removes an index from a collection, if one exist.
static Task< IPersistentDictionary > GetDictionary(string Collection)
Gets a persistent dictionary containing objects in a collection.
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.
static Task DeleteLazy< T >(params string[] SortOrder)
Finds objects of a given class T and deletes them in the same atomic operation.
static Task< IEnumerable< object > > Find(string Collection, Filter Filter, params string[] SortOrder)
Finds objects in a given collection.
static Task< IEnumerable< T > > FindDelete< T >(params string[] SortOrder)
Finds objects of a given class T and deletes them in the same atomic operation.
static void EndRepair(string Collection)
Is called when reparation of a collection is ended.
static Task EndBulk()
Ends bulk-processing of data. Must be called once for every call to StartBulk.
static bool HasProvider
If a database provider is registered.
static Task< string[]> Analyze(XmlWriter Output, string XsltPath, string ProgramDataFolder, bool ExportData)
Analyzes the database and exports findings to XML.
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.
static CaseInsensitiveString[] ToCaseInsensitiveStringArray(this string[] A)
Converts a case insensitive string array to a normal string array.
static async Task< T > FindFirstIgnoreRest< T >(params string[] SortOrder)
Finds the first object of a given class T and ignores the rest.
static Task Iterate< T >(IDatabaseIteration< T > Recipient)
Performs an iteration of contents of the entire database.
static Task< bool > IsLabel(string Collection, string Label)
Checks if a string is a label in a given collection.
static string[] GetExcludedCollections()
Gets an array of collections that should be excluded from backups.
static Task< object > TryGetObjectId(object Object)
Tries to get the Object ID of an object, if it exists.
static async Task InsertLazy(object Object)
Inserts an object into the database, if unlocked. If locked, object will be inserted at next opportun...
static void Register(IDatabaseProvider DatabaseProvider)
Registers a database provider for use from the static Database class, throughout the lifetime of the ...
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.
static IDatabaseProvider Provider
Registered database provider.
static Task< IPage< object > > FindNext(IPage< object > Page)
Finds the next page of objects in a given collection.
static async Task Update(params object[] Objects)
Updates a collection of objects in the database.
static Task< IEnumerable< object > > Find(string Collection, int Offset, int MaxCount, Filter Filter, params string[] SortOrder)
Finds objects in a given collection.
static async Task Update(IEnumerable< object > Objects)
Updates a collection of objects in the database.
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.
static Task AddIndex(string CollectionName, string[] FieldNames)
Adds an index to a collection, if one does not already exist.
static string WildcardToRegex(string s, string Wildcard)
Converts a wildcard string to a regular expression string.
static Task< string[]> GetCollections()
Gets an array of available collections.
static Task< bool > Export(IDatabaseExport Output)
Performs an export of the database.
static Exception FlagForRepair(string Collection, string Reason)
Flags a collection for repairing.
static Task< IPage< object > > FindFirst(string Collection, int PageSize, params string[] SortOrder)
Finds the first page of objects in a given collection.
static ObjectEventHandler ObjectDeleted
Event raised when an object has been deleted.
static Task StartBulk()
Starts bulk-proccessing of data. Must be followed by a call to EndBulk.
static async Task Delete(IEnumerable< object > Objects)
Deletes a collection of objects in the database.
static void BeginRepair(string Collection)
Is called when reparation of a collection is begin.
static Task< IEnumerable< object > > Find(string Collection, int Offset, int MaxCount, params string[] SortOrder)
Finds objects in a given collection.
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 databa...
static async Task UpdateLazy(object Object)
Updates an object in the database, if unlocked. If locked, object will be updated at next opportunity...
static async Task UpdateLazy(IEnumerable< object > Objects)
Updates a collection of objects in the database, if unlocked. If locked, objects will be updated at n...
static CollectionEventHandler CollectionCleared
Event raised when a collection has been cleared.
static bool Locked
If the datbase provider has been locked for the rest of the run-time of the application.
static Task< bool > Export(IDatabaseExport Output, string[] CollectionNames, ProfilerThread Thread)
Performs an export of the database.
static Task< string[]> Analyze(XmlWriter Output, string XsltPath, string ProgramDataFolder, bool ExportData, bool Repair)
Analyzes the database and exports findings to XML.
static string[] ToStringArray(this CaseInsensitiveString[] A)
Converts a case insensitive string array to a normal string array.
static async Task Update(object Object)
Updates an object in the database.
static Task< GenericObject > Generalize(object Object)
Creates a generalized representation of an object.
static Task< string > GetCollection(Type Type)
Gets the collection corresponding to a given type.
static async Task Delete(object Object)
Deletes an object in the database.
static async Task< T > LoadObject< T >(object ObjectId)
Loads an object given its Object ID ObjectId and its base type T .
static async Task< object > LoadObject(string CollectionName, object ObjectId)
Loads an object given its Object ID ObjectId and its collection name CollectionName .
static Task< string[]> GetLabels(string Collection)
Gets an array of available labels for a collection.
static async Task Insert(params object[] Objects)
Inserts a set of objects into the default collection of the database.
static string[] GetFlaggedCollectionNames()
Gets the names of the collections that have been flagged as possibly corrupt.
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.
static Task< object > Specialize(GenericObject Object)
Creates a specialized representation of a generic object.
static async Task DeleteLazy(params object[] Objects)
Deletes a collection of objects in the database, if unlocked. If locked, objects will be deleted at n...
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.
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.
static ObjectEventHandler ObjectInserted
Event raised when an object has been inserted.
static Task< IEnumerable< object > > Find(string Collection, params string[] SortOrder)
Finds objects in a given collection.
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.
static async Task Insert(object Object)
Inserts an object into the default collection of the database.
static async Task UpdateLazy(params object[] Objects)
Updates a collection of objects in the database, if unlocked. If locked, objects will be updated at n...
static CollectionRepairedEventHandler CollectionRepaired
Event raised when a collection has been repaired.
static Task< object > TryLoadObject(string CollectionName, object ObjectId)
Tries to load an object given its Object ID ObjectId and its collection name CollectionName .
static async Task< T > FindFirstDeleteRest< T >(params string[] SortOrder)
Finds the first object of a given class T and deletes the rest.
static async Task InsertLazy(params object[] Objects)
Inserts an object into the database, if unlocked. If locked, object will be inserted at next opportun...
static async Task Insert(IEnumerable< object > Objects)
Inserts a set of objects into the default collection of the database.
static void Register(IDatabaseProvider DatabaseProvider, bool Lock)
Registers a database provider for use from the static Database class, throughout the lifetime of the ...
static async Task DeleteLazy(IEnumerable< object > Objects)
Deletes a collection of objects in the database, if unlocked. If locked, objects will be deleted at n...
static Task DropCollection(string CollectionName)
Drops a collection, if it exist.
static Task< IPage< object > > FindFirst(string Collection, int PageSize, Filter Filter, params string[] SortOrder)
Finds the first page of objects in a given collection.
static async Task Delete(params object[] Objects)
Deletes a collection of objects in the database.
static Task< IPage< T > > FindFirst< T >(int PageSize, params string[] SortOrder)
Finds the first page of objects of a given class T .
static async Task< PaginatedEnumerator< object > > Enumerate(string Collection, int PageSize, params string[] SortOrder)
Finds the first page of objects in a given collection.
static async Task InsertLazy(IEnumerable< object > Objects)
Inserts an object into the database, if unlocked. If locked, object will be inserted at next opportun...
static async Task Clear(string CollectionName)
Clears a collection of all objects.
Database inconsistency exception. Raised when an inconsistency in the database has been found.
Base class for all filter classes.
Source of code flagging a collection for repair.
int Count
Number of times the collection has been flagged from this source.
Event arguments for database object events.
Paginated object enumerator.
Generic object. Contains a sequence of properties.
Class that keeps track of events and timing for one thread.
Interface for database providers that can be plugged into the static Database class.
Task Update(object Object)
Updates an object in the database.
Task InsertLazy(object Object, ObjectCallback Callback)
Inserts an object into the database, if unlocked. If locked, object will be inserted at next opportun...
Task< string[]> Repair(XmlWriter Output, string XsltPath, string ProgramDataFolder, bool ExportData)
Analyzes the database and repairs it if necessary. Results are exported to XML.
Task< object > TryLoadObject(string CollectionName, object ObjectId)
Tries to load an object given its Object ID ObjectId and its collection name CollectionName .
Task< IPage< object > > FindFirst(string Collection, int PageSize, params string[] SortOrder)
Finds the first page of objects in a given collection.
Task< object > TryGetObjectId(object Object)
Tries to get the Object ID of an object, if it exists.
Task AddIndex(string CollectionName, string[] FieldNames)
Adds an index to a collection, if one does not already exist.
Task Delete(object Object)
Deletes an object in the database.
Task< object > Specialize(GenericObject Object)
Creates a specialized representation of a generic object.
Task< IEnumerable< object > > Find(string Collection, int Offset, int MaxCount, params string[] SortOrder)
Finds objects in a given collection.
Task< bool > IsLabel(string Collection, string Label)
Checks if a string is a label in a given collection.
Task< string[]> GetLabels(string Collection)
Gets an array of available labels for a collection.
Task< string > GetCollection(Type Type)
Gets the collection corresponding to a given type.
Task< bool > Export(IDatabaseExport Output, string[] CollectionNames)
Performs an export of the database.
Task< string[]> GetCollections()
Gets an array of available collections.
Task Clear(string CollectionName)
Clears a collection of all objects.
Task< string[]> GetDictionaries()
Gets an array of available dictionary collections.
Task EndBulk()
Ends bulk-processing of data. Must be called once for every call to StartBulk.
Task UpdateLazy(object Object, ObjectCallback Callback)
Updates an object in the database, if unlocked. If locked, object will be updated at next opportunity...
Task< GenericObject > Generalize(object Object)
Creates a generalized representation of an object.
Task Insert(object Object)
Inserts an object into the database.
Task DeleteLazy(object Object, ObjectCallback Callback)
Deletes an object in the database, if unlocked. If locked, object will be deleted at next opportunity...
Task< IPersistentDictionary > GetDictionary(string Collection)
Gets a persistent dictionary containing objects in a collection.
Task< string[]> Analyze(XmlWriter Output, string XsltPath, string ProgramDataFolder, bool ExportData)
Analyzes the database and exports findings to XML.
string[] GetExcludedCollections()
Gets an array of collections that should be excluded from backups.
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.
Task DropCollection(string CollectionName)
Drops a collection, if it exist.
Task RemoveIndex(string CollectionName, string[] FieldNames)
Removes an index from a collection, if one exist.
Task< IPage< object > > FindNext(IPage< object > Page)
Finds the next page of objects in a given collection.
Task StartBulk()
Starts bulk-proccessing of data. Must be followed by a call to EndBulk.
Interface for paginated results.
Interface for database exports.
Interface for iterations of database contents.
delegate void ObjectEventHandler(object Sender, ObjectEventArgs e)
Event handler for object events.
delegate Task CollectionEventHandler(object Sender, CollectionEventArgs e)
Event handler for collection events.
delegate Task CollectionRepairedEventHandler(object Sender, CollectionRepairedEventArgs e)
Event handler for collection repaired events.