Sitecore Core Development

Friday, November 04, 2005

IDTable

Sitecore 5.1.1 contains a new feature called IDTable.

The purpose of IDTable is to provide DataProvider developers with a map between arbitrary keys and IDs that can be used in Sitecore. For instance, the FileSystem DataProvider uses the full path of a file as key.

The IDTable persists the relation between the key and the ID, so that a key always returns the same ID.

The API of IDTable is very simple:

public static IDTableEntry Add(string prefix, string key, ID id) {
public static IDTableEntry Add(string prefix, string key, ID id, ID parentID) {
public static IDTableEntry Add(string prefix, string key, ID id, ID parentID, string customData) {
public static IDTableEntry GetID(string prefix, string key) {
public static IDTableEntry[] GetKeys(string prefix, ID id) {
public static IDTableEntry GetNewID(string prefix, string key) {
public static IDTableEntry GetNewID(string prefix, string key, ID parentID) {
public static IDTableEntry GetNewID(string prefix, string key, ID parentID, string customData) {
public static void RemoveID(string prefix, ID id) {
public static void RemoveKey(string prefix, string key) {

Most of the functions operate on the IDTableEntry class. This class has 5 properties:
string Prefix
string Key
ID ID
ID ParentID
string CustomData

The prefix is an identifier that all keys are prefixed with. In the FileSystem database this prefix should be "FileSystem". The ParentID property can be used if the DataProvider does not have an intrinsic parent/child relation like the FileSystem have, for instance a Customer/Order releation is an SQL database. The CustomData is a user-defined property.

IDTable is implemented as a provider model. Sitecore supplies default implementations for all database providers: SQL Server, Firebird and Oracle.

To configure IDTable, add the following section to the web.config:


<IDTable type="Sitecore.Data.IDTables.SqlIDTable,Sitecore.SqlServer">
<param desc="connection" ref="connections/master" />
<param desc="cacheSize">500KB</param>
</IDTable>

This setup enables IDTable to run on the SQL Server table in the Master database.

3 Comments:

  • and here come the spammers!
    Australian article directory

    By Anonymous GeoArticleDude, at 5:41 PM  

  • Who knows where to download XRumer 5.0 Palladium?
    Help, please. All recommend this program to effectively advertise on the Internet, this is the best program!

    By Anonymous Anonymous, at 5:48 AM  

  • Nice idea! I never try to make a flower tissue before, Anyway, thanks for sharing this post. I've got an idea.

    By Anonymous send flowers to germany, at 11:51 PM  

Post a Comment

<< Home