generateUuid

generateUuid(variant: Integer): Binary;

The generateUuid method of the Application class generates and returns a binary Universally Unique Identifier (UUID) value, which can be used as an attribute of an object so that it can be exposed to third-parties.

Use one of the following global constants in the UUIDVariants category for the variant parameter, to specify the layout of the UUID.

Global Constant Integer Value Description
VariantDce 2 Distributed Computing Environment, a Version 2 UUID based on date‑ time and MAC address.
VariantMicrosoft 3 Generates a UUID using CoCreateGuid, which .NET Guid.NewGuid() also uses. Currently this is a Version 4 UUID and is the most unique UUID you can have. This is the recommended variant.
VariantNcs 1 Reserved for NCS (Network Computing System) backward compatibility.

The following code example shows the use of the generateUuid method.

create() updating;
begin
    self.uuid := app.generateUuid(VariantDce);
end;

You can use the generateUuidDefault method to generate the recommended UUID without having to specify the variant.