GenID Object [C++]

Use this object to generate globally unique identifiers (GUID), or to create and maintain multiple, global sequential counters that are persisted in a database. A global counter is one that can work across multiple computers.

ProgID:   Commerce.GenID (Externally creatable)
COM Class Name:   GenID
Type Library Name:   Microsoft Commerce 2002 GenID Type Library
DLL Name:   GenID.dll
Threading Model:   Both

[C++]

COM Interface Name:   IGenID
Interface ID Constant:   IID_IGenID
Header File:   genid.h

[C++]

In C++, use the IGenID interface to access the methods of the GenID object.

Methods

[C++]

Method Description
GenBase5GUIDString Generates a base5 GUID string.
GenGUIDString Generates a GUID string.
GetCounterValue Retrieves the value of the specified counter and then increments the counter.
Initialize Connects the GenID object to the database that stores the table of counters.
InitializeCounter Initializes a new counter or resets an existing counter.

[Visual Basic]

Method Description
GenBase5GUIDString Generates a base5 GUID string.
GenGUIDString Generates a GUID string.
GetCounterValue Retrieves the value of the specified counter and then increments the counter.
Initialize Connects the GenID object to the database that stores the table of counters.
InitializeCounter Initializes a new counter or resets an existing counter.

Remarks

To create a GUID using Visual Basic .NET or C#, use System.Guid.

Strings that are stored as a global unique identifier (GUID) must begin and end with curly brackets “{” and “}”. This is the case with user_id, which is processed by the Profile data import task, and address_id, which is processed by the Transaction data import task. Make sure you insert the beginning and ending curly bracket before writing an event to the Web log file.

For example, your site must generate the GUID in the Commerce event of the type CEVT={T=ORD,EVT=SUBOR,ORID="fd5823ed-cac9-4b29-aa82-a18fe43b78e8"} as {fd5823ed-cac9-4b29-aa82-a18fe43b78e8}. The CSOLEDB provider does not convert the GUID if the required beginning and ending curly brackets are missing.

The Retail Solution Site uses the MSCSGenID object to create a GUID with curly brackets, for example:

Set Application("MSCSGenID") = oGetGenIDObject()
Function oGetGenIDObject() Set oGetGenIDObject = Server.CreateObject("Commerce.GenID") End Function

The Retail 2002 site uses the SYSTEM.GUID object, and then formats the string to add the GUID, for example:

Accountmanager.cs string profileID = string.Format("{0}{1}{2}", '{', guidString, '}');
public static string GenerateProfileID()
        {
            //
            // Create a guid. In .net this does not contain the curly brackets.
            //
              Guid guid = Guid.NewGuid();
           //
           // The profile service takes ID's as strings (and stores them nvarchar not as uniqueidentifier)
          //
              string guidString = guid.ToString();
          //
          // Add in the curly bracket.
          //
            string profileID = string.Format("{0}{1}{2}", '{', guidString, '}');
            return profileID;
        }

Copyright © 2005 Microsoft Corporation.
All rights reserved.