Access the RealTime database (RTDB)
- Last UpdatedApr 24, 2025
- 1 minute read
To use the RealTime database (RTDB) Object Model API, applications should reference the following assemblies:
-
OASySDNA.RealTime.Data.Common.dll โ The Common assembly contains structures and functions that are not directly related to the database schema, such as lock type enumerations.
-
OASySDNA.RealTime.Data.Model.dll โ The Model assembly contains objects representing all tables (in I<TableName> format), records, fields and types in the RTDB.
The following example provides a simple read of the name field of a record in the analog table.
Note: The dataContext class acts as the entry point for both connecting to the RTDB and as a factory for generating objects that represent rows and tables.
using OASySDNA.RealTime.Data.Common;
using OASySDNA.RealTime.Data.Common.HighPerformanceDBWrapper;
using OASySDNA.RealTime.Data.Model;
int analogPtNum = 1;
RealTimeDatabase.Open();
using (var dataContext = new DataContext(new RecordCollectionFactory()))
{
using (var analogTable = dataContext.CollectionFor<IAnalog>())
{
analogTable.Single(analogPtNum,
analog => { Console.WriteLine($"Analog with ptnum {analogPtNum} name is {analog.Name}"); },
LockType.SAFE_READ, LockType.SAFE_READ);
}
}
RealTimeDatabase.Close();