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