Customizing EntityType

Posts   
 
    
Posts: 48
Joined: 14-Oct-2008
# Posted on: 16-Oct-2008 04:15:54   

I see that there is an EntityType enum that is declared for all of the entities that get created. It appears that this enum is created in alphabetical order.

I have a few questions about this:

  1. Is it possible to specify the values of each of the enum values?
  2. Is there any way to guarantee that the value of each enum will NOT change from generation to generation?

I ask because I intend to use Guids as my unique IDs, but I plan to embed the object type in the Guid so that if I ever look at a Guid in my database I'll know what type of object it is.

In order for this to work, I need to know that the EntityType ID's won't change from build to build of the generated code.

(You may wonder why I don't know based on what table the guid is in... well I plan to have a 'Notes' table that can essentially point to any object in my database - I would like to know what the object type is when looking at the guid in this table.)

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 16-Oct-2008 05:09:58   

Unfortunately that's no possible (directly) AFAIK. You should write your own ConstantEnums template.

A better approach wold be: at some class on your custom code, write equivalences between EntityType values and Guids values. So you always will be able to convert from Gui values to EntityType.

David Elizondo | LLBLGen Support Team
Posts: 48
Joined: 14-Oct-2008
# Posted on: 16-Oct-2008 05:15:40   

daelmo wrote:

Unfortunately that's no possible (directly) AFAIK. You should write your own ConstantEnums template.

A better approach wold be: at some class on your custom code, write equivalences between EntityType values and Guids values. So you always will be able to convert from Gui values to EntityType.

I've added this thread to the Feature Requests forum. Thanks.