#1 2024-07-22 11:25:01

larand54
Member
Registered: 2018-12-25
Posts: 104

Problems convert mormotDDD unit to mormot2

I try to convert the  "mormotDDD" unit to be used by mORMot2 because I like to use "CQRS" the way it is used in the old mormot DDD-example.

It seemed to be an easy task from the beginning but I'm stopped by a few things.

The TClassInstance is not available in mORMot2. It look like "TRttiClass" could be used here but it is not defined the same.
The "    property Aggregate: TClass read fAggregate.rttiClass ;" does not work as rttiClass is a function and not a field.

There are a few more things to fix but I think this is the most important to fix. The other may be solved easier when this is solved. Otherwise I'll come back and ask for more help.


Delphi-11, WIN10

Offline

#2 2024-07-22 13:00:15

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,653
Website

Re: Problems convert mormotDDD unit to mormot2

It is not the same: TRttiClass is just a wrapper around the RTTI of a class - as its name actually suggests. wink

In mORMot 2, I guess the way to deal with these classes runtime creation is to use TRttiCustom e.g. from Rtti.RegisterClass().
Then you can just call TRttiCustom.ClassNewInstance to allocate a new class instance of the class.

Offline

Board footer

Powered by FluxBB