InheritanceStrategy.SingleTable and TInheritanceStrategy.JoinedTables

can i use the InheritanceStrategy.SingleTable and TInheritanceStrategy.JoinedTables?
because you created the THerFilho2 table that you shouldn't have created and did not create the Test2 field in the THerBase table.

[Entity, Automapping]
[Inheritance(TInheritanceStrategy.SingleTable)]
[DiscriminatorColumn('tipo', TDiscriminatorType.dtInteger)]
THerBase = class
private
FId: int64;
FNome: string;
public
property Id: int64 read FId write FId;
property Nome: string read FNome write FNome;
end;

[Entity, Automapping]
[DiscriminatorValue(1)]
THerFilho1 = class(THerBase)
private
FTeste: string;
public
property Teste: string read FTeste write FTeste;
end;

[Entity, Automapping]
[DiscriminatorValue(2)]
[Inheritance(TInheritanceStrategy.JoinedTables)]
THerFilho2 = class(THerBase)
private
FTeste2: string;
public
property Teste2: string read FTeste2 write FTeste2;
end;

[Entity, Automapping]
THerFilho3 = class(THerFilho2)
private
FTeste3: string;
public
property Teste3: string read FTeste3 write FTeste3;
end;

Unfortunately you can't mix JoinedTables and SingleTable inheritance strategies in the same class hierarchy.

This topic was automatically closed 60 minutes after the last reply. New replies are no longer allowed.