Enum Type Converter

Posts   
 
    
chungpn
User
Posts: 39
Joined: 23-Mar-2011
# Posted on: 20-Apr-2011 09:56:22   

I have a enum type like this public enum PersonGender { NoSpecifed,Male, Female }

Do I need a typeconver class to use in LLBLGEN 3.1 and how to use this enum type in llblgen?

Thank you.

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 20-Apr-2011 16:13:07   

How exactly do you want to use that enum? Do you have a database field which has values that should be mapped to this enum?

chungpn
User
Posts: 39
Joined: 23-Mar-2011
# Posted on: 21-Apr-2011 03:03:30   

Walaa wrote:

How exactly do you want to use that enum?

I have a emplyee table, now I want the type "gender" is mapped on the gender field that is a int type when llblgen genearte code like this:

public virtual Nullable<PersonGender> Gender { get { return (Nullable<PersonGender>)GetValue((int)EmployeeFieldIndex.Gender, false); } set { SetValue((int)EmployeeIndex.Gender, value); } }

Walaa wrote:

Do you have a database field which has values that should be mapped to this enum?

yes, the gender field in table emplyee is a int type should be mapped to this enum value.

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 21-Apr-2011 05:38:00   

Please read this section in the manual which explain this topic.

David Elizondo | LLBLGen Support Team
chungpn
User
Posts: 39
Joined: 23-Mar-2011
# Posted on: 21-Apr-2011 09:09:18   

Thank you