EtheaDev / InstantObjects

Pupular OOP-OPF Library for Delphi (from D2010 to 11 Alexandria)

Home Page:https://ethea.it/instantobjects/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Working with legacy DataBase

Loucif-Fouad opened this issue · comments

I can't figure out how to use the framework with an existing database.

It's a problem, because InstantObjects need a particular structure of database.
Any table mapped to a Class must have three fields:
CLASS, ID and UPDATECOUNT and for Reference fields REFERENCEFIELD_CLASS and REFERENCEFIELD_ID.
This is because to Retrieve an Object from Database a statement that retrieve the object keys is used like:
SELECT CLASS, ID FROM TABLE WHERE ...
Then, for every record a Retrieve of the object is made, using CLASS and ID.
Same concept about a referenced object: using REFERENCEFIELD_CLASS and REFERENCEFIELD_ID an object of the referenced tabled is retrieved.
Another prerequisite is that the ID field must be unique, so normally is the Primary key of a table, and it's a character field of 32 chars, often used to store a compact GUID.

In other words it's not possible?

Yes and sorry but the architecture of the library requires a particular structure of the DB.