$ID

 

Each object that is stored in the database is assigned with a unique identification number (or ID, sometimes referred as UID – unique ID).

In all queries, you can identify the object by referencing its ID by using a $ID identifier. This is useful when you need to have a unique identifier for the object.

 

Queries using $ID.

 

You can perform the database query using the following:

 

long uid = db.Store(user);

 

Parameters param = db.CreateParameters();

param["id"] = uid;

var res = db.ExecuteScalar("SELECT BasicUser WHERE $ID = @id", param);

 

$ID pseudo-field is reserved name and can be used in conjunction with any object even if the object does not have that property. Database will interpret $ID as “use an ID of the object”.