Invalid Mapping with fixed Enum

I have 2 different Enum-Types.

[Enumeration(TEnumMappingType.emString, 'Test,Dumm,Work')
TEnumOne = (Test, Dummy, Works);
[Enumeration(TEnumMappingType.emString, 'sTest,sDumm,sWork')
TEnumTwo = (secTest = ord(Test), secDummy, secWorks);

Each is used in a different Model.

Because TEnumTwo starts with ord(Test), this leads to an AccessViolation in

TMappingExplorer.InternalRttiTypeToFieldType

on line:
if RttiType.Handle = TypeInfo(Integer) then

As you can see in callstack, RttiType is nil...

Aurelius.Mapping.Explorer.TMappingExplorer.InternalRttiTypeToFieldType(nil,0,False,False)
Aurelius.Mapping.Explorer.TMappingExplorer.ResolveColumnType($1C696420)
Aurelius.Mapping.Automapping.TAutomapping.AutoGetColumnsFromScalarMember($1C6ABF80)
Aurelius.Mapping.Explorer.TMappingExplorer.DefineMetaProperties.AutoMap$ActRec.$0$Body
Aurelius.Mapping.Explorer.TMappingExplorer.LoadPropColumns($1C6AD600)
Aurelius.Mapping.Explorer.TMappingExplorer.FindAbstractEntityType(TClass($39976A0))
Aurelius.Mapping.Explorer.TMappingExplorer.FindAbstractEntityType(TClass($39A8358))
Aurelius.Mapping.Explorer.TMappingExplorer.FindEntityType(TClass($39A8358))
Aurelius.Mapping.Explorer.TMappingExplorer.LoadMapping

Unfortunately Delphi doesn't provide RTTI info for enumerated type with explicit values. Thus, those types are simply not supported.

We have improved the error message here, instead of an Access Violation, Aurelius will raise an exception with a message informing that such type is not supported. Next version will include such improvement.

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