Aurelius 4.18 does not compile

Hi,
After update to 4.18, i can not compile anymore with Delphi 10.3
...
fCriteria := TCriteria.Create(TClub, Manager);
...
[dcc32 Error] DB.Club.pas(88): E2010 Incompatible types: 'TEntityType' and 'class of TClub'
[dcc32 Error] DB.Club.pas(172): E2010 Incompatible types: 'TEntityType' and 'class of TClub'

Thanks

That's not a usual way to create a Criteria. You should use it this way:

fCriteria := Manager.CreateCriteria(TClub);

Hi Wagner
I've been working with aurelius for five to six years, always like this, do I have to change my entire code?
Thanks

It would be safer if you change your code, as you are using it in a way that is always subject to change/break. Manager.CreateCriteria is safer.

Is it feasible for you to change? Or, is it feasible to you to add a unit to uses clause to add a helper? This way a helper class could be created to add an overloaded Create. The equivalente code would be something like this:

constructor TCriteriaHelper.Create(Clazz: TClass; Manager: TMappingExplorer);
begin
  Create(Manager.Explorer.EntityTypeFromClass(Clazz), Manager);
end;

Hi, for now older version installed.
Later i will change the code.
Thanks, Wagner

1 Like

Hi, Wagner
After I change the code after you sugeste, compile perfectly. Now i have another issue, the serialize is broken:

TSummary = class
private
FSMounth: String;
FSCount: Integer;
public
constructor Create( aSMounth, aSCount: Variant);
destructor Destroy(); override;
property SMounth: String read FSDate write FSDate;
property SCount: Integer read FSCount write FSCount;
end;
...
fSummaryList := TObjectList.Create;
for i := 0 to 12 do
begin
aSCount := SQLCount(i); //select count(C1) from Invoice where ...
fSummaryList.Add(TSummary.Create( i, aSCount));
end;

Result := FSerializer.ToJson(fSummaryList);
...

BEFORE UPDATE
[{"$type":"DB.Schema.View.TSummary","$id":1,"FSMounth":1,"FSCount":24},
{"$type":"DB.Schema.View.TSummary","$id":1,"FSMounth":2,"FSCount":11},
...
]

AFTER UPDATE
[{"$type":"DB.Schema.View.TSummary","$id":1},
{"$type":"DB.Schema.View.TSummary","$id":1}
...
]

Delphi 10.3 Enterprise, DataSnap Rest/JSON, Aurelius

Thanks

Can you please send a project reproducing the serialization error?