in an entity I cannot have a DTO-type association? because it gives the following error: EEntityTypeClassNotMapped: Cannot create entity type class TTotaisItens. Class is not mapped
[Entity]
[Table('mat_movimento')]
[Id('FId', TIdGenerator.IdentityOrSequence)]
[Sequence('seq_mat_movimento')]
[Inheritance(TInheritanceStrategy.JoinedTables)]
TMovimentoMat = class(TModeloBsc)
private
[Column('id', [TColumnProp.Required])]
FId: int64;
[Column('entrada_saida', [TColumnProp.Required])]
FEntradaSaida: integer;
[Transient]
FTotaisItens: TTotaisItens;
[JsonInclude(TInclusionMode.NonDefault)]
TTotaisItens = class
Mercadoria: currency;
Itens: currency;
Pecas: currency;
Valor: currency;
end;
Have you defined
TTotaisItens = class;
before TMovimentoMat declaration?
Could you paste or check the original source code section where you have declared TMovimentoMat & TTotaisItens ?
No errors here using this structure, Neither declaring outside of the main entity, nor inside of it as a nested type.
wlandgraf
(Wagner Landgraf)
November 10, 2020, 4:29pm
5
You can have any properties in your entity class, as long as they are not mapped to the database. You can map a non-entity class to the database.
I want the FTotaisItens property to go to json. when I put [XDataProperty] there is an error in the application initialization
EEntityTypeClassNotMapped: Cannot create entity type class TTotaisItens. Class is not mapped
function TXDataModelBuilder.DefineEntityType(AClass: TClass): TXDataEntityType;
wlandgraf
(Wagner Landgraf)
November 11, 2020, 11:45am
10
Indeed, XDataProperty
only works for primitive types, not object types.
system
(system)
Closed
December 22, 2020, 8:35pm
11
This topic was automatically closed 60 minutes after the last reply. New replies are no longer allowed.