Enum type is nested inside a class

Posts   
 
    
lmcen
User
Posts: 6
Joined: 25-Nov-2020
# Posted on: 25-Nov-2020 23:42:52   

I have an enum inside a class, which I want to use it in the field mapping:

namespace EnumTypes {
  public abstract class ClassWithInner{
    public enum InnerEnum : short  { ... }
  }
}

According to LLBLGen doc:
Enum types nested inside a class type need a different specification: using a + delimiter...

<typeImports>
    <typeImport typeName="EnumTypes.ClassWithInner+InnerEnum" assemblyFile="\Myprojects\MyEnumDlls\EnumTypes.dll"/>
</typeImports>

I followed the instruction and I can see that the type is available(ClassWithInner+InnerEnum) when setting the type of the field. But the generated C# code is like:

public ClassWithInner+InnerEnum MyField { get; set; }

which is not valid. I would expect it generates

public ClassWithInner.InnerEnum MyField { get; set; }

and no type converter required to convert it from/to "short". Does it work like this way?

cenlm
daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 26-Nov-2020 06:47:33   

Hi lmcen,

  • What LLBLGen version are you using?
  • What Framework are you generating for (LLBLGen Runtime I assume)

For the Enum full qualified name in the generated code: we will investigate it further.

For the type converter part of your question: the type conversion is needed in order to pass from enum to the actual type the DB is expecting, however that is done behind the scenes.

David Elizondo | LLBLGen Support Team
lmcen
User
Posts: 6
Joined: 25-Nov-2020
# Posted on: 26-Nov-2020 15:12:38   
  • What LLBLGen version are you using? I'm using LLBLGen Pro 5.7.0 (Also tried v5.7.2 - the same)
  • What Framework are you generating for (LLBLGen Runtime I assume) Entity Framework
cenlm
daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 27-Nov-2020 06:36:21   

We will look into it.

David Elizondo | LLBLGen Support Team
Otis avatar
Otis
LLBLGen Pro Team
Posts: 39747
Joined: 17-Aug-2003
# Posted on: 27-Nov-2020 13:18:29   

Fixed in the 5.7.2 hotfix that was just released.

Frans Bouma | Lead developer LLBLGen Pro
lmcen
User
Posts: 6
Joined: 25-Nov-2020
# Posted on: 27-Nov-2020 19:30:42   

It is working with the latest hotfix of v5.7.2. Also, no customized type converter is needed. It seems working the same as the "normal" enumeration. Thank you! Great work!

cenlm