Suggestion: Constraints = enum

Posts   
 
    
aim48
User
Posts: 9
Joined: 21-Nov-2005
# Posted on: 25-Dec-2005 07:31:27   

hi,

I have a suggestion - This might be a bit difficult to do becuase the constraints might be hard to parse and detect however it would be great if you could parse a filed with a check constraint that only allows specific values i.e.

CONSTRAINT [CK_t_SalesItems] CHECK ([ItemStatus] = 'INSTOCK' or [ItemCode] = 'BACKORDR' or [ItemCode] ='DSCNTNUD')

Anyways since the idea is to limit the values enterd into the column it might be a good idea to generate the column as a enum type and the enum type would contain

public enum SalesItemsItemStatus { INSTOCK, BACKORDR, DSCNTNUD }

Then you could set or read the filed using one of the values that are in the field

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39933
Joined: 17-Aug-2003
# Posted on: 25-Dec-2005 11:02:42   

The problem is parsing the checkconstraint. As that can be anything, it's really hard to do. We're looking into generating enum values from the designer for 2.0 (not set in stone, but it's on the table). Thanks for the suggestion though simple_smile

Frans Bouma | Lead developer LLBLGen Pro