Skip to main content

IDatabase

Interface for database operations including variable persistence and event logging.

Namespace: ControlBee.Interfaces

Methods

WriteVariables

Writes a variable value to the database.

int WriteVariables(VariableScope scope, string localName, string actorName, string itemPath, string value);

Returns: The database record ID.

WriteEvents

Writes an event record to the database.

void WriteEvents(string actorName, string name, string severity, string? code = null, string? desc = null);

ReadAll

Reads all records from the specified table.

DataTable ReadAll(string tableName, QueryOptions? options = null);

Read

Reads a single variable value.

(int id, string value)? Read(string localName, string actorName, string itemPath);

Returns: A tuple of ID and value, or null.

ReadAllVariables

Reads all variables for a given local name.

Dictionary<(string localName, string actorName, string itemPath), (int id, string value)> ReadAllVariables(string localName);

GetLocalNames

Returns all available local (recipe) names.

string[] GetLocalNames();

DeleteLocal

Deletes all data for the specified local name.

void DeleteLocal(string localName);

RenameLocalName

Renames a local name.

void RenameLocalName(string sourceLocalName, string targetLocalName);

WriteVariableChange

Writes a variable change record.

void WriteVariableChange(IVariable variable, ValueChangedArgs valueChangedArgs);

ReadVariableChanges

Reads variable change history.

DataTable ReadVariableChanges(QueryOptions? options = null);

GetConnection

Returns the underlying database connection.

object GetConnection();

ReadLatestVariableChanges

Reads the most recent variable changes.

DataTable ReadLatestVariableChanges();

See Also