Feature suggestion - Enums

Posts   
 
    
tomahawk
User
Posts: 169
Joined: 02-Mar-2005
# Posted on: 23-Jun-2006 20:39:55   

Hey there,

Most databases have reference tables. A table that just contains an ID, and some text describing it. Like so,

ID Descrip

CA California WA Washington AZ Arizona

Or

ID PhoneType

1 Home 2 Business 3 Mobile

It would be great if a user could indicate to LLBLGen (in the designer) which tables are reference tables, and LLBLGen would generate Enums for you. And then you could use these Enums in your code instead of trying to remember the strings. And you get the compile time check.

So instead of

IPredicate p = (PhoneTypeFields.PhoneType == "Home");

// or the even less readable but more common
IPredicate p = (PhoneTypeFields.ID == 1);

you could do

IPredicate p = (PhoneTypeFields.PhoneType == PhoneTypes.Home);
bclubb
User
Posts: 934
Joined: 12-Feb-2004
# Posted on: 24-Jun-2006 00:15:34   

I believe this has been suggested before, but is not likely to be included.

What you may look into is using a TypeConverter that will convert the field into the enum that you would like to use.

Another possibility is to use Enum generator task performer in the 3rd Party section to help with this. http://www.llblgen.com/tinyforum/Messages.aspx?ThreadID=1125&HighLight=1 This thread is introduction.