This project is read-only.

Wish: Flag Option for Type Table

Feb 26, 2011 at 5:57 AM

Would it be possible to make whether or not the enum generated from a Type Table is a set of flags (i.e., have the enum decorated with the Flag attribute)? I find I use enums as flags about half the time.

Feb 26, 2011 at 2:15 PM

This not something that we will do soon. This requires a model change and some validation rules associated with it. It is something we might explore but right now we are full trying to get more templates out and rework the existing ones. What would adding an attribute to the enum buy you? What would you do with it? Please explain how you want to use it.

Feb 26, 2011 at 4:16 PM

Right now the enum that gets generated cannot be used as a set of flags:

public enum AccessRights
Add = 1,
Edit = 2,
Delete = 4

if( (user.AccessRights &  AccessRights.Delete) ) ... allow deletion

Feb 26, 2011 at 8:10 PM

I know how to use the bit flags; I was just wondering why you need an attribute on th enum to tell you that it is an bit flag. Since you are the one who built the model, you know that it is a bit flag. You can build code just like that now. I am confused what adding another attribute to the enumeration would matter.