[odb-users] Encapsulating ODB

Adam Walters awalters at spsy.com
Mon Jul 26 20:46:45 EDT 2021


Hi,
I am looking at using ODB in a Windows application that has multiple projects. I would like to create a database layer that encapsulates the database 'magic' and thus hides the implementation from the projects that consume the services. Although ODB encapsulates the database code, the classes used for persistence have to reference the ODB includes so that the pragmas and other references compile. I looked at the polymorphic options but there doesn't seem to be a way to (for example) derive the persisted class from a non-persisted one. This would allow me to create the persisted entities as pointers to base class objects that did not reference any ODB code and thus consume the objects in other projects without having to reference the ODB code. This is obviously better than having a parallel set of business objects and copying the data between these and the persisted class objects.
Does anyone have a suggestion as to how I can achieve this or am I stuck with referencing ODB include paths in all of the projects that use the database classes?

Thanks,
Adam


More information about the odb-users mailing list