Prev Next |
Introduced in Sitecore 5.1.1, the IDTable class provides persistent mapping of arbitrary keys to Sitecore IDs. The IDTable stores the arbitrary keys as strings. For example, the Sitecore File System data provider uses a file’s full path as the file key. Using the IDTable, the File System data provider maps the file’s full path to a Sitecore ID, so that a given file path always returns the same Sitecore ID.
The IDTable may be configured in the web.config file via the following section.
<IDTable type=”Sitecore.Data.IDTables.SqlIDTable,Sitecore.SqlServer”>
<param desc=”connection” ref=”connections/master”/>
<param desc=”cacheSize”>500KB</param>
</IDTable>
This example configures the IDTable to run as an SQL Server table in the Master database.
The IDTable class provides the following methods:
Signature |
Return Value |
Method |
Parameters |
Description |
public static |
IDTableEntry |
Add |
string prefix
|
Add an entry to the IDTable for a given prefix, key, and ID. |
public static |
IDTableEntry |
Add |
string prefix
|
Add an entry to the IDTable for a given prefix, key, and ID. Include the Parent ID in the entry. |
public static |
IDTableEntry |
Add |
string prefix
|
Add an entry to the IDTable for a given prefix, key, and ID. Include the Parent ID and custom data in the entry. |
public static |
IDTableEntry |
GetID |
string prefix
|
Returns the entry for the item with the given prefix and key. |
public static |
IDTableEntry[] |
GetKeys |
string prefix
|
Returns the entries associated with the given prefix and ID. The method returns an array to allow for a one-to-many mapping of keys to Sitecore IDs. |
public static |
IDTableEntry |
GetNewID |
string prefix
|
Returns an entry containing a new ID and the given prefix and key. |
public static |
IDTableEntry |
GetNewID |
string prefix
|
Returns an entry containing a new ID and the given prefix, key, and parentID. |
public static |
IDTableEntry |
GetNewID |
string prefix
|
Returns an entry containing a new ID and the given prefix, key, parentID, customData. |
public static |
void |
RemoveID |
string prefix
|
Removes the entry with the provided ID from the table. |
public static |
void |
RemoveKey |
string prefix
|
Removes the entry with the provided key from the table. |
Prev Next