Hi,
When mapping Id in an [AbstractEntity] it does not work, and I get the folowing exception:
ECannotFindPropertyKey with message 'Property "TMyBaseClass.FId" could not be defined as key in entity type'
My implementation is similar to the one found in the documentation:
But with only 1 field (FId) in abastract class.
If I change TMyBaseClass mapping from [AbstractEntity] to [Entity] it works.
Any thougts?
wlandgraf
(Wagner Landgraf)
2
Can you please provide the full mapping and/or the project so we can reproduce it here?
Hi @wlandgraf, thanks for your help. 2 units:
Abstract entity:
unit MyAbstractEntity;
uses
System.SysUtils,
Aurelius.Mapping.Attributes;
type
TObjectId = Int64;
[AbstractEntity]
[Automapping]
[Id('FId', TIdGenerator.IdentityOrSequence)]
TBusinessObject = class
strict private
FId: TObjectId;
public
property Id: TObjectId read FId write FId;
end;
implementation
end.
Concrete entity:
unit MyConcreteEntity;
interface
uses
Aurelius.Types.Nullable,
Aurelius.Types.Blob,
Aurelius.Types.Proxy,
Aurelius.Mapping.Attributes,
MyAbstractEntity;
type
[Enumeration(TEnumMappingType.emInteger)]
TSituacaoUsuario = (Regular, Bloqueado);
[Entity]
[Table('USUARIOS')]
[Sequence('SEQ_USUARIOS')]
TUsuario = class(TBusinessObject)
private
[Column('NOME', [], 65)]
FNome: string;
[Column('EMAIL', [], 260)]
FEmail: Nullable<string>;
[Column('SITUACAO', [])]
FSituacao: TSituacaoUsuario;
public
property Nome: string read FNome write FNome;
property Email: Nullable<string> read FEmail write FEmail;
property Situacao: TSituacaoUsuario read FSituacao write FSituacao;
end;
implementation
initialization
RegisterEntity(TUsuario);
end.
Regards,
Hi @wlandgraf,
I'm attaching a test project to reproduce the problem. The project was created with Delphi 10.4.2 Pro
You'll need Firebird 3 to test it.
Run and click 'Start' button.
TestProject.zip (92.9 KB)
wlandgraf
(Wagner Landgraf)
5
Thank you very much. We could reproduce it. It was not clear that the problem was in XData, not Aurelius. The fix will be included in next release.
Now It makes sense. I could not reproduce it making changes to (pure) Aurelius demos.
Thank you very much!