Unique ID of a new entity

Posts   
 
    
IT
User
Posts: 37
Joined: 02-Dec-2003
# Posted on: 20-Dec-2003 18:54:55   

Hi Otis,

Anyway to get a Unique ID from a new entity object (i.e not saved yet -so No PK available) confused

I looked at entity.gethashcode and entity.fields.gethashcode but they both return Zero for a new object

Refmanual doc/GetHashCode : Overrides the GetHashCode routine. It will calculate a hashcode for this entity using the eXclusive OR of the hashcodes of the primary key fields in this entity. That hashcode is returned. If no primary key fields are present, the hashcode of the base class is returned, which will not be unique.

It would be very handy if every object created got a unique ID that could be used to identify the object eventhough it is "new"

As an alternative - would it be possible make a Tag property (type : object) available on all entities (like on forms and form controls)

This would allow the developer attach various info to the entity and in my present case stamp new items with an intermediate ID untill the entity is saved sunglasses

...IT

IT
User
Posts: 37
Joined: 02-Dec-2003
# Posted on: 20-Dec-2003 19:44:24   

hmm - thinking about it - I could extend the entity class in the two class scenario with the Tag property - or a more dedicated property/functionality - now that You have given us the power to do so stuck_out_tongue_winking_eye

...IT

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39933
Joined: 17-Aug-2003
# Posted on: 20-Dec-2003 20:32:11   

The entity object's base class in the new library will have a GUID field for ID purposes. simple_smile For now, you indeed can add the field to the class yourself.

Frans Bouma | Lead developer LLBLGen Pro
KPat
User
Posts: 15
Joined: 26-Mar-2004
# Posted on: 28-Dec-2004 18:57:23   

Any update on this Otis? Is there a way to uniquely identify new SelfServicing Entities?

-K

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39933
Joined: 17-Aug-2003
# Posted on: 28-Dec-2004 20:07:49   

ObjectID is also present in selfservicing entities.

Frans Bouma | Lead developer LLBLGen Pro