-
Notifications
You must be signed in to change notification settings - Fork 5
CDP4 ORM
The COMET data is stored in tables in a relational Database. The data needs to be read from and written to these tables. The COMET Services make use of DTO's to perform the required business logic. A mapping needs to be made to and from DTO's and the relational tables. A custom, performance optimized Object Relational Mapping layer has been created to achieve this. For each class in the COMET data-model a so-called DAO interface and class is generated. These contain methods contain the SQL used to access the database.
The COMET data-model is an object oriented model that relies on inheritance. The inheritance has been modelled into the database. Each COMET type (class) is represented in the database with it's own table.
The COMET makes use of PostgreSQL which is an ACID compliant database which has support for transactions. This principle is used when operating on the database using the DAO interfaces and classes. Each CRUD operation that is the result of a request on the COMET Services, a single transaction object is used. This allows the framework to operate (both read and write) on multiple data types in one transaction.
The IDao interfaces are injected in the COMET Services framework to read and write objects from and to the database. These IDao interfaces are only present for the concrete classes in the COMET data-model. The interfaces are implemented in partial class files which makes it possible to add manual written code in dedicated files to extend the generated interfaces.
Each Dao Interface exposes the following methods:
IEnumerable<CDP4Common.DTO.XXX> Read(NpgsqlTransaction transaction, string partition, IEnumerable<Guid> ids = null, bool isCachedDtoReadEnabledAndInstant = false);
bool Write(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.XXX xxx, CDP4Common.DTO.Thing container = null);
bool Update(NpgsqlTransaction transaction, string partition, CDP4Common.DTO.XXX xxx, CDP4Common.DTO.Thing container = null);
bool ReorderCollectionProperty(NpgsqlTransaction transaction, string partition, string propertyName, Guid iid, CDP4Common.Types.OrderedItem orderUpdate);
bool AddToCollectionProperty(NpgsqlTransaction transaction, string partition, string propertyName, Guid iid, object value);
bool Delete(NpgsqlTransaction transaction, string partition, Guid iid);
bool DeleteFromCollectionProperty(NpgsqlTransaction transaction, string partition, string propertyName, Guid iid, object value);
These methods are specific to a specific subclass of CDP4Common.DTO.Thing
. The above methods contain placeholders XXX and xxx to illustrate this principle.
The Read
method is used to query the DTO's of a specific type from the COMET database. The read method returns an IEnumerable, where the T is the concrete DTO that can be accessed using the IDao interface. The following parameters are required on the Read method:
-
NpgsqlTransaction
transaction: The -
string
partition: -
IEnumerable<Guid>
ids: and optional list of unique identifiers of the objects that are queried. If this list is null or empty all available objects will be returned. -
bool
isCachedDtoReadEnabledAndInstant: a value that indicates whether the objects should be read from the DTO cache or not. The DTO cache only contains the latest state or version of a DTO.
MORE INFORMATION COMING SOON
MORE INFORMATION COMING SOON
MORE INFORMATION COMING SOON
MORE INFORMATION COMING SOON
MORE INFORMATION COMING SOON
MORE INFORMATION COMING SOON
copyright @ Starion Group S.A.