You are not logged in.
Pages: 1
Concerns mORMot2
Note: The following change is not necessary but useful and convenient in my case.
Class inheritance:
TObjectWithCustomCreate -> TBaseOrm -> TOrm
The TBaseOrm class should only have the IDValue property that it remains lightweight.
As I described in this thread, for interface passed services I use on the server objects inherited from class TOrm and on the client the same objects as business objects, only here they are inherited from class TBom (with simple compiler switches). Class TBom is currently inherited from TObjectWithCustomCreate and has only one property IDValue. The client also has classes inherited from TOrm that use the local database, so I always have to write the following:
if ((SourceObject is TOrm) and (TOrm(SourceObject).IDValue ...))
or ((SourceObject is TBom) and (TBom(SourceObject).IDValue ...)) then ...
If TOrm had a base class TBaseOrm with the IDValue property, I could shorten it as follows:
if (SourceObject is TBaseOrm) and (TBaseOrm(SourceObject).IDValue ...) then ...
With best regards
Thomas
Offline
So what you propose is to make KDD even one step further, and ignore the whole TOrm features, and expose the same class properties, either as TOrm or as TObjectWithID.
It is a complex but clever trick.
I have introduced a TObjectWithID class, new parent of TOrm, for your purpose.
Your idea of having an ORM-agnostic class on client side may be part of mORMot itself in the future.
Offline
So what you propose is to make KDD even one step further, and ignore the whole TOrm features, and expose the same class properties, either as TOrm or as TObjectWithID.
It is a complex but clever trick.
Thank you for the kind words and the quick implementation. This makes my day.
With best regards
Thomas
Offline
Pages: 1