You are not logged in.
Pages: 1
I'd like to be able to copy the (published) property values from a TSynPersistent subclass to a TOrm subclass - only the ones that match by name and type. I've been trawling through the v1 DDD code but have noticed it's not ported to v2. I can see a set of useful functions in the v2 rtti unit but is there anything elsewhere in v2 to simplify this? Or should I just use what's in the rtti unit and roll my own?
Thanks, Bob
Offline
My guess is that CopyObject() from mormot.core.rtti could do this.
But by default, not with the same exact type.
I have added an option to customize CopyObject() overloaded functions.
See https://github.com/synopse/mORMot2/commit/a1cf9893
Offline
Arnold have u some method similar to copy values from RecordToObject and ObjectToRecord?
Offline
I have made a huge refactoring to make it possible.
See the new RecordToObject() and ObjectToRecord() functions:
https://github.com/synopse/mORMot2/commit/df088c84
Offline
The modified CopyObject works perfectly - thank you.
Offline
I have introduced the new TRttiMap wrapper feature.
It is designed to ease any kind of class/record, class/class or record/record field mapping.
For instance, it is a very good fit for safe and fast DTO process, and is likely to be used in the context of DDD or KDD process, perhaps in a easier way than in mORMot 1.
Please try
https://github.com/synopse/mORMot2/commit/61864d9d
Offline
WAW!!!!!!!!!!!!!!!!!!!!!
Very very very thanks Arnold. This is a Great Feature to MORMOT. 10 points Gain
Offline
Pages: 1