Sitecore 5.0 API

Database.Masters Property

Retrieves masters from the database.

[Visual Basic]
Public ReadOnly Property Masters As MasterRecords
[C#]
public MasterRecords Masters {get;}

Remarks

A database may define a number of masters.

A master is an instance of a template much like an item. When an item is created from a master, the master is copied into the new item which receives all the field values from the master. A master may contain subitems that are created whenever an item is created from a master.

Masters can be retrieved either using their ID or by their name.

Example

This example creates a new item.

public Item AddItem(Item parent, string name) {
  Item result = null;

  MasterItem master = Sitecore.Context.Database.Masters["Document"];
  
  if (master != null) {
    result = parent.Add(name, master);
  }

  return result;
}

See Also

Database Class | Sitecore.Data Namespace