Using SingleTable-Inheritance I could not provide Enum-Fields for SubClasses.
Example:
type
[Entity]
[Inheritance(TInheritanceStrategy.SingleTable)]
[DiscriminatorColumn('MEDIA_TYPE', TDiscriminatorType.dtString)]
TMediaFile = class
private
[Column('ID', [TColumnProp.Unique, TColumnProp.Required, TColumnProp.DontUpdate])]
FId: Integer;
public
property Id: integer read FId;
end;
[Enumeration(TEnumMappingType.emString, 'MP3,WAV')]
TSongFormat= (tsfMP3, tsfWAV);
TSong = class(TMediaFile)
private
FSongFormat: TSongFormat;
public
property SongFormat: TSongFormat read FSongFormat write FSongFormat;
end;
[Enumeration(TEnumMappingType.emString, 'MP4,MPEG')]
TVideoFormat= (tvfMP4, tvfMPEG);
[Entity]
[DiscriminatorValue('VIDEO')]
TVideo = class(TMediaFile)
private
FVideoFormat: TVideoFormat;
public
property VideoFormat: TVideoFormat read FVideoFormat write FVideoFormat;
end;
Inserting TVideo will raise NULL-Exception on FSongFormat, while Inserting TSong will raise NULL-Exception on FVideoFormat...