4using System.Threading.Tasks;
20 private readonly Dictionary<string, bool> isLabel =
new Dictionary<string, bool>();
21 private readonly
string collectionName;
22 private readonly
string alias;
47 KeyValuePair<VariableReference, bool>[] Order,
ScriptNode Node)
58 IEnumerable<object> Objects = await
Database.
Find(this.collectionName, Offset, Top,
89 return await
Database.
Process(Processor, this.collectionName, Offset, Top,
106 KeyValuePair<VariableReference, bool>[] Order,
ScriptNode Node)
110 if (Filter is
null && Offset == 0 && Top ==
int.MaxValue)
129 public Task
Update(
bool Lazy, IEnumerable<object> Objects)
139 public Task
Insert(
bool Lazy,
object Object)
154 get {
return string.Empty; }
162 get =>
string.IsNullOrEmpty(this.alias) ? this.collectionName : this.alias;
173 string.Compare(this.collectionName,
Name,
true) == 0 ||
174 string.Compare(this.alias,
Name,
true) == 0;
188 if (this.isLabel.TryGetValue(Label, out Result))
196 this.isLabel[Label] = Result;
211 StringBuilder sb =
new StringBuilder();
212 foreach (
string Field
in Fields)
213 sb.AppendLine(Field);
225 string Key =
"SQL.INDEX." + this.collectionName +
"." +
Name;
227 string[] Fields = s.Split(crlf, StringSplitOptions.RemoveEmptyEntries);
228 if (Fields.Length == 0)
237 private static readonly
char[] crlf =
new char[] {
'\r',
'\n' };
Static interface for database persistence. In order to work, a database provider has to be assigned t...
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< bool > Process(IProcessor< object > Processor, string Collection, params string[] SortOrder)
Processes objects in a given collection.
static Task< bool > IsLabel(string Collection, string Label)
Checks if a string is a label in a given collection.
static async Task InsertLazy(object Object)
Inserts an object into the database, if unlocked. If locked, object will be inserted at next opportun...
static Task AddIndex(string CollectionName, string[] FieldNames)
Adds an index to a collection, if one does not already exist.
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 Update(object Object)
Updates an object in the database.
static async Task Delete(object Object)
Deletes an object in the database.
static Task< IEnumerable< object > > Find(string Collection, params string[] SortOrder)
Finds objects in a given collection.
static async Task Insert(object Object)
Inserts an object into the default collection of the database.
static Task DropCollection(string CollectionName)
Drops a collection, if it exist.
static async Task Clear(string CollectionName)
Clears a collection of all objects.
Base class for all filter classes.
Generic object. Contains a sequence of properties.
Static class managing persistent settings.
static async Task< string > GetAsync(string Key, string DefaultValue)
Gets a string-valued setting.
static async Task< bool > SetAsync(string Key, string Value)
Sets a string-valued setting.
Base class for all nodes in a parsed script tree.
Processor of generic objects of type GenericObject.
Data Source defined by a collection name
async Task< bool > DropIndex(string Name)
Drops an index from the source.
CollectionSource(string CollectionName, string Alias)
Data Source defined by a collection name
Task Update(bool Lazy, IEnumerable< object > Objects)
Updates a set of objects.
async Task< bool > IsLabel(string Label)
Checks if the label is a label in the source.
Task Insert(bool Lazy, object Object)
Inserts an object.
async Task< IResultSetEnumerator > Find(int Offset, int Top, bool Generic, ScriptNode Where, Variables Variables, KeyValuePair< VariableReference, bool >[] Order, ScriptNode Node)
Finds objects matching filter conditions in Where .
async Task CreateIndex(string Name, string[] Fields)
Creates an index in the source.
string TypeName
Name of corresponding type.
string Name
Collection name or alias.
async Task< int?> Delete(bool Lazy, int Offset, int Top, ScriptNode Where, Variables Variables, KeyValuePair< VariableReference, bool >[] Order, ScriptNode Node)
Deletes a set of objects.
async Task< bool > Process(IProcessor< object > Processor, int Offset, int Top, bool Generic, ScriptNode Where, Variables Variables, KeyValuePair< VariableReference, bool >[] Order, ScriptNode Node)
Processes objects matching filter conditions in Where .
Task DropCollection()
Drops the collection specified by the source.
bool IsSource(string Name)
Checks if the name refers to the source.
string CollectionName
Name of corresponding collection.
Data Source defined by a type definition
Interface for processors of objects.
Interface for data sources that can be used in SQL statements.