Skip to content
Ken Sykora edited this page Feb 9, 2015 · 2 revisions

Vault.Context is the main entry point for any type of object retrieval using the ORM. Below are some of the main methods you might use for getting items outside of the current Umbraco document/page context.

Meet the Vault.Context.____ Methods

  • T GetCurrent<T>() Retrieves a data item for the current node. T is the object type to cast the item to.
  • object GetCurrent(Type type) Non-generic retrieval of a data item for the current node.
  • T GetContentById<T>(string idString) Retrieves a data item with the specified ID.
  • T GetContentById<T>(int id) Retrieves a data item with the specified ID.
  • T GetMediaById<T>(string idString) Retrieves a media item with the specified ID.
  • T GetMediaById<T>(int id) Retrieves a media item with the specified ID.
  • IEnumerable<T> GetContentByCsv<T>(string csv) Retrieves content matching the csv. (TODO: What does the csv look like?)
  • IEnumerable<T> GetByDocumentType<T>() Retrieves all documents of the specified type.
  • IEnumerable<string> GetUrlsForDocumentType<T>() Retrieves URLs for all documents of the specified type.
  • IEnumerable<T> GetChildren<T>(int? parentNodeId = null) Retrieves all children of the specified NodeId (or the root if no parentNodeId specified) that are of type T.```
  • IEnumerable<T> QueryRelative<T>(string query) Executes the specified XPath query. (TODO: Example or something)