Class UmbracoHelper
A helper class that provides many useful methods and functionality for using Umbraco in templates
Inheritance
System.Object
Namespace:System.Dynamic.ExpandoObject
Assembly:umbraco.dll
Syntax
public class UmbracoHelper : IUmbracoComponentRenderer
Constructors
UmbracoHelper()
Empty constructor to create an umbraco helper for access to methods that don't have dependencies
Declaration
UmbracoHelper(UmbracoContext)
Standard constructor setting the current page to the page that has been routed to
Declaration
public UmbracoHelper(UmbracoContext umbracoContext)
Parameters
UmbracoHelper(UmbracoContext, IPublishedContent)
Custom constructor setting the current page to the parameter passed in
Declaration
public UmbracoHelper(UmbracoContext umbracoContext, IPublishedContent content)
Parameters
UmbracoHelper(UmbracoContext, IPublishedContent, ITypedPublishedContentQuery, IDynamicPublishedContentQuery, ITagQuery, IDataTypeService, UrlProvider, ICultureDictionary, IUmbracoComponentRenderer, MembershipHelper)
Constructor accepting all dependencies
Declaration
public UmbracoHelper(UmbracoContext umbracoContext, IPublishedContent content, ITypedPublishedContentQuery typedQuery, IDynamicPublishedContentQuery dynamicQuery, ITagQuery tagQuery, IDataTypeService dataTypeService, UrlProvider urlProvider, ICultureDictionary cultureDictionary, IUmbracoComponentRenderer componentRenderer, MembershipHelper membershipHelper)
Parameters
UmbracoHelper(UmbracoContext, IPublishedContent, PublishedContentQuery)
Declaration
[Obsolete("Use the constructor specifying all dependencies")]
public UmbracoHelper(UmbracoContext umbracoContext, IPublishedContent content, PublishedContentQuery query)
Parameters
UmbracoHelper(UmbracoContext, PublishedContentQuery)
Declaration
[Obsolete("Use the constructor specifying all dependencies")]
public UmbracoHelper(UmbracoContext umbracoContext, PublishedContentQuery query)
Parameters
Properties
AssignedContentItem
Returns the current IPublishedContent item assigned to the UmbracoHelper
Declaration
public IPublishedContent AssignedContentItem { get; }
Property Value
Exceptions
Type |
Condition |
System.InvalidOperationException |
Thrown if the UmbracoHelper is constructed with an UmbracoContext and it is not a front-end request
|
ContentQuery
Lazy instantiates the query context if not specified in the constructor
Declaration
public PublishedContentQuery ContentQuery { get; }
Property Value
CultureDictionary
Returns the ICultureDictionary for access to dictionary items
Declaration
public ICultureDictionary CultureDictionary { get; }
Property Value
DataTypeService
Lazy instantiates the IDataTypeService if not specified in the constructor
Declaration
public IDataTypeService DataTypeService { get; }
Property Value
MembershipHelper
Lazy instantiates the membership helper if not specified in the constructor
Declaration
public MembershipHelper MembershipHelper { get; }
Property Value
TagQuery
Lazy instantiates the tag context
Declaration
public TagQuery TagQuery { get; }
Property Value
UmbracoComponentRenderer
Lazy instantiates the IUmbracoComponentRenderer if not specified in the constructor
Declaration
public IUmbracoComponentRenderer UmbracoComponentRenderer { get; }
Property Value
UmbracoContext
Helper method to ensure an umbraco context is set when it is needed
Declaration
public UmbracoContext UmbracoContext { get; }
Property Value
UrlProvider
Lazy instantiates the UrlProvider if not specified in the constructor
Declaration
public UrlProvider UrlProvider { get; }
Property Value
Methods
Coalesce(Object[])
Will take the first non-null value in the collection and return the value of it.
Declaration
public string Coalesce(params object[] args)
Parameters
Type |
Name |
Description |
System.Object[] |
args |
|
Returns
Type |
Description |
System.String |
|
Concatenate(Object[])
Will take the first non-null value in the collection and return the value of it.
Declaration
public string Concatenate(params object[] args)
Parameters
Type |
Name |
Description |
System.Object[] |
args |
|
Returns
Type |
Description |
System.String |
|
Content(IEnumerable<Int32>)
Gets content items from the cache.
Declaration
public dynamic Content(IEnumerable<int> ids)
Parameters
Type |
Name |
Description |
System.Collections.Generic.IEnumerable<System.Int32> |
ids |
The unique identifiers of the content items.
|
Returns
Type |
Description |
System.Object |
The content items that were found in the cache.
|
Content(IEnumerable<Object>)
Gets content items from the cache.
Declaration
public dynamic Content(IEnumerable<object> ids)
Parameters
Type |
Name |
Description |
System.Collections.Generic.IEnumerable<System.Object> |
ids |
The unique identifiers, or the keys, of the content items.
|
Returns
Type |
Description |
System.Object |
The content items that were found in the cache.
|
Content(IEnumerable<String>)
Gets content items from the cache.
Declaration
public dynamic Content(IEnumerable<string> ids)
Parameters
Type |
Name |
Description |
System.Collections.Generic.IEnumerable<System.String> |
ids |
The unique identifiers, or the keys, of the content items.
|
Returns
Type |
Description |
System.Object |
The content items that were found in the cache.
|
Content(Int32)
Gets a content item from the cache.
Declaration
public dynamic Content(int id)
Parameters
Type |
Name |
Description |
System.Int32 |
id |
The unique identifier of the content item.
|
Returns
Type |
Description |
System.Object |
The content, or DynamicNull of the content item is not in the cache.
|
Content(Int32[])
Gets content items from the cache.
Declaration
public dynamic Content(params int[] ids)
Parameters
Type |
Name |
Description |
System.Int32[] |
ids |
The unique identifiers of the content items.
|
Returns
Type |
Description |
System.Object |
The content items that were found in the cache.
|
Content(Object)
Gets a content item from the cache.
Declaration
public dynamic Content(object id)
Parameters
Type |
Name |
Description |
System.Object |
id |
The unique identifier, or the key, of the content item.
|
Returns
Type |
Description |
System.Object |
The content, or DynamicNull of the content item is not in the cache.
|
Content(Object[])
Gets content items from the cache.
Declaration
public dynamic Content(params object[] ids)
Parameters
Type |
Name |
Description |
System.Object[] |
ids |
The unique identifiers, or the keys, of the content items.
|
Returns
Type |
Description |
System.Object |
The content items that were found in the cache.
|
Content(String)
Gets a content item from the cache.
Declaration
public dynamic Content(string id)
Parameters
Type |
Name |
Description |
System.String |
id |
The unique identifier, or the key, of the content item.
|
Returns
Type |
Description |
System.Object |
The content, or DynamicNull of the content item is not in the cache.
|
Content(String[])
Gets content items from the cache.
Declaration
public dynamic Content(params string[] ids)
Parameters
Type |
Name |
Description |
System.String[] |
ids |
The unique identifiers, or the keys, of the content items.
|
Returns
Type |
Description |
System.Object |
The content items that were found in the cache.
|
ContentAtRoot()
Declaration
public dynamic ContentAtRoot()
Returns
Type |
Description |
System.Object |
|
ContentAtXPath(String, XPathVariable[])
Declaration
public dynamic ContentAtXPath(string xpath, params XPathVariable[] vars)
Parameters
Returns
Type |
Description |
System.Object |
|
ContentAtXPath(XPathExpression, XPathVariable[])
Declaration
public dynamic ContentAtXPath(XPathExpression xpath, params XPathVariable[] vars)
Parameters
Type |
Name |
Description |
System.Xml.XPath.XPathExpression |
xpath |
|
XPathVariable[] |
vars |
|
Returns
Type |
Description |
System.Object |
|
ContentSingleAtXPath(String, XPathVariable[])
Declaration
public dynamic ContentSingleAtXPath(string xpath, params XPathVariable[] vars)
Parameters
Returns
Type |
Description |
System.Object |
|
ContentSingleAtXPath(XPathExpression, XPathVariable[])
Declaration
public dynamic ContentSingleAtXPath(XPathExpression xpath, params XPathVariable[] vars)
Parameters
Type |
Name |
Description |
System.Xml.XPath.XPathExpression |
xpath |
|
XPathVariable[] |
vars |
|
Returns
Type |
Description |
System.Object |
|
CreateHash(String)
Generates a hash based on the text string passed in. This method will detect the
security requirements (is FIPS enabled) and return an appropriate hash.
Declaration
public string CreateHash(string text)
Parameters
Type |
Name |
Description |
System.String |
text |
The text to create a hash from
|
Returns
Type |
Description |
System.String |
Hash of the text string
|
CreateMd5Hash(String)
Returns an MD5 hash of the string specified
Declaration
[Obsolete("Please use the CreateHash method instead. This may be removed in future versions")]
public string CreateMd5Hash(string text)
Parameters
Type |
Name |
Description |
System.String |
text |
The text to create a hash from
|
Returns
Type |
Description |
System.String |
Md5 hash of the string
|
EnableCanvasDesigner()
Declaration
[Obsolete("Use EnableCanvasDesigner on the HtmlHelper extensions instead")]
public IHtmlString EnableCanvasDesigner()
Returns
Type |
Description |
System.Web.IHtmlString |
|
EnableCanvasDesigner(String)
Declaration
[Obsolete("Use EnableCanvasDesigner on the HtmlHelper extensions instead")]
public IHtmlString EnableCanvasDesigner(string canvasdesignerConfigPath)
Parameters
Type |
Name |
Description |
System.String |
canvasdesignerConfigPath |
|
Returns
Type |
Description |
System.Web.IHtmlString |
|
EnableCanvasDesigner(String, String)
Declaration
[Obsolete("Use EnableCanvasDesigner on the HtmlHelper extensions instead")]
public IHtmlString EnableCanvasDesigner(string canvasdesignerConfigPath, string canvasdesignerPalettesPath)
Parameters
Type |
Name |
Description |
System.String |
canvasdesignerConfigPath |
|
System.String |
canvasdesignerPalettesPath |
|
Returns
Type |
Description |
System.Web.IHtmlString |
|
Field(String, String, String, String, String, Boolean, Boolean, Boolean, RenderFieldCaseType, RenderFieldEncodingType, Boolean, Boolean, String)
Declaration
public IHtmlString Field(string fieldAlias, string altFieldAlias = "", string altText = "", string insertBefore = "", string insertAfter = "", bool recursive = false, bool convertLineBreaks = false, bool removeParagraphTags = false, RenderFieldCaseType casing = RenderFieldCaseType.Unchanged, RenderFieldEncodingType encoding = RenderFieldEncodingType.Unchanged, bool formatAsDate = false, bool formatAsDateWithTime = false, string formatAsDateWithTimeSeparator = "")
Parameters
Type |
Name |
Description |
System.String |
fieldAlias |
|
System.String |
altFieldAlias |
|
System.String |
altText |
|
System.String |
insertBefore |
|
System.String |
insertAfter |
|
System.Boolean |
recursive |
|
System.Boolean |
convertLineBreaks |
|
System.Boolean |
removeParagraphTags |
|
RenderFieldCaseType |
casing |
|
RenderFieldEncodingType |
encoding |
|
System.Boolean |
formatAsDate |
|
System.Boolean |
formatAsDateWithTime |
|
System.String |
formatAsDateWithTimeSeparator |
|
Returns
Type |
Description |
System.Web.IHtmlString |
|
Field(IPublishedContent, String, String, String, String, String, Boolean, Boolean, Boolean, RenderFieldCaseType, RenderFieldEncodingType, Boolean, Boolean, String)
Declaration
public IHtmlString Field(IPublishedContent currentPage, string fieldAlias, string altFieldAlias = "", string altText = "", string insertBefore = "", string insertAfter = "", bool recursive = false, bool convertLineBreaks = false, bool removeParagraphTags = false, RenderFieldCaseType casing = RenderFieldCaseType.Unchanged, RenderFieldEncodingType encoding = RenderFieldEncodingType.Unchanged, bool formatAsDate = false, bool formatAsDateWithTime = false, string formatAsDateWithTimeSeparator = "")
Parameters
Type |
Name |
Description |
IPublishedContent |
currentPage |
|
System.String |
fieldAlias |
|
System.String |
altFieldAlias |
|
System.String |
altText |
|
System.String |
insertBefore |
|
System.String |
insertAfter |
|
System.Boolean |
recursive |
|
System.Boolean |
convertLineBreaks |
|
System.Boolean |
removeParagraphTags |
|
RenderFieldCaseType |
casing |
|
RenderFieldEncodingType |
encoding |
|
System.Boolean |
formatAsDate |
|
System.Boolean |
formatAsDateWithTime |
|
System.String |
formatAsDateWithTimeSeparator |
|
Returns
Type |
Description |
System.Web.IHtmlString |
|
GetDictionaryValue(String)
Returns the dictionary value for the key specified
Declaration
public string GetDictionaryValue(string key)
Parameters
Type |
Name |
Description |
System.String |
key |
|
Returns
Type |
Description |
System.String |
|
GetDictionaryValue(String, String)
Returns the dictionary value for the key specified, and if empty returns the specified default fall back value
Declaration
public string GetDictionaryValue(string key, string altText)
Parameters
Type |
Name |
Description |
System.String |
key |
key of dictionary item
|
System.String |
altText |
fall back text if dictionary item is empty - Name altText to match Umbraco.Field
|
Returns
Type |
Description |
System.String |
|
GetIdForUdi(Udi)
Declaration
public int GetIdForUdi(Udi udi)
Parameters
Type |
Name |
Description |
Udi |
udi |
|
Returns
Type |
Description |
System.Int32 |
|
GetPreValueAsString(Int32)
Gets a specific PreValue by its Id
Declaration
public string GetPreValueAsString(int id)
Parameters
Type |
Name |
Description |
System.Int32 |
id |
Id of the PreValue to retrieve the value from
|
Returns
Type |
Description |
System.String |
PreValue as a string
|
If(Boolean, String)
If the test is true, the string valueIfTrue will be returned, otherwise the valueIfFalse will be returned.
Declaration
public HtmlString If(bool test, string valueIfTrue)
Parameters
Type |
Name |
Description |
System.Boolean |
test |
|
System.String |
valueIfTrue |
|
Returns
Type |
Description |
System.Web.HtmlString |
|
If(Boolean, String, String)
If the test is true, the string valueIfTrue will be returned, otherwise the valueIfFalse will be returned.
Declaration
public HtmlString If(bool test, string valueIfTrue, string valueIfFalse)
Parameters
Type |
Name |
Description |
System.Boolean |
test |
|
System.String |
valueIfTrue |
|
System.String |
valueIfFalse |
|
Returns
Type |
Description |
System.Web.HtmlString |
|
IsProtected(Int32, String)
Declaration
[Obsolete("Use the IsProtected method that only specifies path")]
public bool IsProtected(int documentId, string path)
Parameters
Type |
Name |
Description |
System.Int32 |
documentId |
|
System.String |
path |
|
Returns
Type |
Description |
System.Boolean |
|
IsProtected(String)
Check if a document object is protected by the "Protect Pages" functionality in umbraco
Declaration
public bool IsProtected(string path)
Parameters
Type |
Name |
Description |
System.String |
path |
The full path of the document object to check
|
Returns
Type |
Description |
System.Boolean |
True if the document object is protected
|
Join(String, Object[])
Joins any number of int/string/objects into one string and seperates them with the string seperator parameter.
Declaration
public string Join(string seperator, params object[] args)
Parameters
Type |
Name |
Description |
System.String |
seperator |
|
System.Object[] |
args |
|
Returns
Type |
Description |
System.String |
|
Gets the medias corresponding to the identifiers.
Declaration
public dynamic Media(IEnumerable<int> ids)
Parameters
Type |
Name |
Description |
System.Collections.Generic.IEnumerable<System.Int32> |
ids |
The media identifiers.
|
Returns
Type |
Description |
System.Object |
The existing medias corresponding to the identifiers.
|
Gets the medias corresponding to the identifiers.
Declaration
public dynamic Media(IEnumerable<object> ids)
Parameters
Type |
Name |
Description |
System.Collections.Generic.IEnumerable<System.Object> |
ids |
The media identifiers.
|
Returns
Type |
Description |
System.Object |
The existing medias corresponding to the identifiers.
|
Gets the medias corresponding to the identifiers.
Declaration
public dynamic Media(IEnumerable<string> ids)
Parameters
Type |
Name |
Description |
System.Collections.Generic.IEnumerable<System.String> |
ids |
The media identifiers.
|
Returns
Type |
Description |
System.Object |
The existing medias corresponding to the identifiers.
|
Declaration
public dynamic Media(int id)
Parameters
Type |
Name |
Description |
System.Int32 |
id |
|
Returns
Type |
Description |
System.Object |
|
Gets the medias corresponding to the identifiers.
Declaration
public dynamic Media(params int[] ids)
Parameters
Type |
Name |
Description |
System.Int32[] |
ids |
The media identifiers.
|
Returns
Type |
Description |
System.Object |
The existing medias corresponding to the identifiers.
|
Declaration
public dynamic Media(object id)
Parameters
Type |
Name |
Description |
System.Object |
id |
|
Returns
Type |
Description |
System.Object |
|
Gets the medias corresponding to the identifiers.
Declaration
public dynamic Media(params object[] ids)
Parameters
Type |
Name |
Description |
System.Object[] |
ids |
The media identifiers.
|
Returns
Type |
Description |
System.Object |
The existing medias corresponding to the identifiers.
|
Declaration
public dynamic Media(string id)
Parameters
Type |
Name |
Description |
System.String |
id |
|
Returns
Type |
Description |
System.Object |
|
Gets the medias corresponding to the identifiers.
Declaration
public dynamic Media(params string[] ids)
Parameters
Type |
Name |
Description |
System.String[] |
ids |
The media identifiers.
|
Returns
Type |
Description |
System.Object |
The existing medias corresponding to the identifiers.
|
Declaration
public dynamic MediaAtRoot()
Returns
Type |
Description |
System.Object |
|
Member(Int32)
Declaration
public dynamic Member(int id)
Parameters
Type |
Name |
Description |
System.Int32 |
id |
|
Returns
Type |
Description |
System.Object |
|
Member(Object)
Declaration
public dynamic Member(object id)
Parameters
Type |
Name |
Description |
System.Object |
id |
|
Returns
Type |
Description |
System.Object |
|
Member(String)
Declaration
public dynamic Member(string id)
Parameters
Type |
Name |
Description |
System.String |
id |
|
Returns
Type |
Description |
System.Object |
|
MemberHasAccess(Int32, String)
Declaration
[Obsolete("Use the MemberHasAccess method that only specifies path")]
public bool MemberHasAccess(int nodeId, string path)
Parameters
Type |
Name |
Description |
System.Int32 |
nodeId |
|
System.String |
path |
|
Returns
Type |
Description |
System.Boolean |
|
MemberHasAccess(String)
Check if the current user has access to a document
Declaration
public bool MemberHasAccess(string path)
Parameters
Type |
Name |
Description |
System.String |
path |
The full path of the document object to check
|
Returns
Type |
Description |
System.Boolean |
True if the current user has access or if the current document isn't protected
|
MemberIsLoggedOn()
Whether or not the current member is logged in (based on the membership provider)
Declaration
public bool MemberIsLoggedOn()
Returns
Type |
Description |
System.Boolean |
True is the current user is logged in
|
NiceUrl(Int32)
Returns a string with a friendly url from a node.
IE.: Instead of having /482 (id) as an url, you can have
/screenshots/developer/macros (spoken url)
Declaration
public string NiceUrl(int nodeId)
Parameters
Type |
Name |
Description |
System.Int32 |
nodeId |
Identifier for the node that should be returned
|
Returns
Type |
Description |
System.String |
String with a friendly url from a node
|
NiceUrlWithDomain(Int32)
This method will always add the domain to the path if the hostnames are set up correctly.
Declaration
public string NiceUrlWithDomain(int nodeId)
Parameters
Type |
Name |
Description |
System.Int32 |
nodeId |
Identifier for the node that should be returned
|
Returns
Type |
Description |
System.String |
String with a friendly url with full domain from a node
|
RenderMacro(String)
Renders the macro with the specified alias.
Declaration
public IHtmlString RenderMacro(string alias)
Parameters
Type |
Name |
Description |
System.String |
alias |
The alias.
|
Returns
Type |
Description |
System.Web.IHtmlString |
|
RenderMacro(String, IDictionary<String, Object>)
Renders the macro with the specified alias, passing in the specified parameters.
Declaration
public IHtmlString RenderMacro(string alias, IDictionary<string, object> parameters)
Parameters
Type |
Name |
Description |
System.String |
alias |
The alias.
|
System.Collections.Generic.IDictionary<System.String, System.Object> |
parameters |
The parameters.
|
Returns
Type |
Description |
System.Web.IHtmlString |
|
RenderMacro(String, Object)
Renders the macro with the specified alias, passing in the specified parameters.
Declaration
public IHtmlString RenderMacro(string alias, object parameters)
Parameters
Type |
Name |
Description |
System.String |
alias |
The alias.
|
System.Object |
parameters |
The parameters.
|
Returns
Type |
Description |
System.Web.IHtmlString |
|
RenderTemplate(Int32, Nullable<Int32>)
Renders the template for the specified pageId and an optional altTemplateId
Declaration
public IHtmlString RenderTemplate(int pageId, int ? altTemplateId = null)
Parameters
Type |
Name |
Description |
System.Int32 |
pageId |
|
System.Nullable<System.Int32> |
altTemplateId |
If not specified, will use the template assigned to the node
|
Returns
Type |
Description |
System.Web.IHtmlString |
|
ReplaceLineBreaksForHtml(String)
Replaces text line breaks with html line breaks
Declaration
public string ReplaceLineBreaksForHtml(string text)
Parameters
Type |
Name |
Description |
System.String |
text |
The text.
|
Returns
Type |
Description |
System.String |
The text with text line breaks replaced with html linebreaks ( )
|
Search(ISearchCriteria, BaseSearchProvider)
Declaration
public dynamic Search(ISearchCriteria criteria, BaseSearchProvider searchProvider = null)
Parameters
Type |
Name |
Description |
Examine.SearchCriteria.ISearchCriteria |
criteria |
|
Examine.Providers.BaseSearchProvider |
searchProvider |
|
Returns
Type |
Description |
System.Object |
|
Search(String, Boolean, String)
Declaration
public dynamic Search(string term, bool useWildCards = true, string searchProvider = null)
Parameters
Type |
Name |
Description |
System.String |
term |
|
System.Boolean |
useWildCards |
|
System.String |
searchProvider |
|
Returns
Type |
Description |
System.Object |
|
StripHtml(String, String[])
Strips all html tags from a given string, all contents of the tags will remain.
Declaration
public HtmlString StripHtml(string html, params string[] tags)
Parameters
Type |
Name |
Description |
System.String |
html |
|
System.String[] |
tags |
|
Returns
Type |
Description |
System.Web.HtmlString |
|
StripHtml(IHtmlString, String[])
Strips all html tags from a given string, all contents of the tags will remain.
Declaration
public HtmlString StripHtml(IHtmlString html, params string[] tags)
Parameters
Type |
Name |
Description |
System.Web.IHtmlString |
html |
|
System.String[] |
tags |
|
Returns
Type |
Description |
System.Web.HtmlString |
|
StripHtml(DynamicNull, String[])
Strips all html tags from a given string, all contents of the tags will remain.
Declaration
public HtmlString StripHtml(DynamicNull html, params string[] tags)
Parameters
Type |
Name |
Description |
DynamicNull |
html |
|
System.String[] |
tags |
|
Returns
Type |
Description |
System.Web.HtmlString |
|
ToDynamicXml(String)
Declaration
public dynamic ToDynamicXml(string xml)
Parameters
Type |
Name |
Description |
System.String |
xml |
|
Returns
Type |
Description |
System.Object |
|
ToDynamicXml(XElement)
Declaration
public dynamic ToDynamicXml(XElement xElement)
Parameters
Type |
Name |
Description |
System.Xml.Linq.XElement |
xElement |
|
Returns
Type |
Description |
System.Object |
|
ToDynamicXml(XPathNodeIterator)
Declaration
public dynamic ToDynamicXml(XPathNodeIterator xpni)
Parameters
Type |
Name |
Description |
System.Xml.XPath.XPathNodeIterator |
xpni |
|
Returns
Type |
Description |
System.Object |
|
Truncate(String, Int32)
Truncates a string to a given length, can add a elipsis at the end (...). Method checks for open html tags, and makes sure to close them
Declaration
public IHtmlString Truncate(string html, int length)
Parameters
Type |
Name |
Description |
System.String |
html |
|
System.Int32 |
length |
|
Returns
Type |
Description |
System.Web.IHtmlString |
|
Truncate(String, Int32, Boolean)
Truncates a string to a given length, can add a elipsis at the end (...). Method checks for open html tags, and makes sure to close them
Declaration
public IHtmlString Truncate(string html, int length, bool addElipsis)
Parameters
Type |
Name |
Description |
System.String |
html |
|
System.Int32 |
length |
|
System.Boolean |
addElipsis |
|
Returns
Type |
Description |
System.Web.IHtmlString |
|
Truncate(String, Int32, Boolean, Boolean)
Truncates a string to a given length, can add a elipsis at the end (...). Method checks for open html tags, and makes sure to close them
Declaration
public IHtmlString Truncate(string html, int length, bool addElipsis, bool treatTagsAsContent)
Parameters
Type |
Name |
Description |
System.String |
html |
|
System.Int32 |
length |
|
System.Boolean |
addElipsis |
|
System.Boolean |
treatTagsAsContent |
|
Returns
Type |
Description |
System.Web.IHtmlString |
|
Truncate(IHtmlString, Int32)
Truncates a string to a given length, can add a elipsis at the end (...). Method checks for open html tags, and makes sure to close them
Declaration
public IHtmlString Truncate(IHtmlString html, int length)
Parameters
Type |
Name |
Description |
System.Web.IHtmlString |
html |
|
System.Int32 |
length |
|
Returns
Type |
Description |
System.Web.IHtmlString |
|
Truncate(IHtmlString, Int32, Boolean)
Truncates a string to a given length, can add a elipsis at the end (...). Method checks for open html tags, and makes sure to close them
Declaration
public IHtmlString Truncate(IHtmlString html, int length, bool addElipsis)
Parameters
Type |
Name |
Description |
System.Web.IHtmlString |
html |
|
System.Int32 |
length |
|
System.Boolean |
addElipsis |
|
Returns
Type |
Description |
System.Web.IHtmlString |
|
Truncate(IHtmlString, Int32, Boolean, Boolean)
Truncates a string to a given length, can add a elipsis at the end (...). Method checks for open html tags, and makes sure to close them
Declaration
public IHtmlString Truncate(IHtmlString html, int length, bool addElipsis, bool treatTagsAsContent)
Parameters
Type |
Name |
Description |
System.Web.IHtmlString |
html |
|
System.Int32 |
length |
|
System.Boolean |
addElipsis |
|
System.Boolean |
treatTagsAsContent |
|
Returns
Type |
Description |
System.Web.IHtmlString |
|
Truncate(DynamicNull, Int32)
Truncates a string to a given length, can add a elipsis at the end (...). Method checks for open html tags, and makes sure to close them
Declaration
public IHtmlString Truncate(DynamicNull html, int length)
Parameters
Type |
Name |
Description |
DynamicNull |
html |
|
System.Int32 |
length |
|
Returns
Type |
Description |
System.Web.IHtmlString |
|
Truncate(DynamicNull, Int32, Boolean)
Truncates a string to a given length, can add a elipsis at the end (...). Method checks for open html tags, and makes sure to close them
Declaration
public IHtmlString Truncate(DynamicNull html, int length, bool addElipsis)
Parameters
Type |
Name |
Description |
DynamicNull |
html |
|
System.Int32 |
length |
|
System.Boolean |
addElipsis |
|
Returns
Type |
Description |
System.Web.IHtmlString |
|
Truncate(DynamicNull, Int32, Boolean, Boolean)
Truncates a string to a given length, can add a elipsis at the end (...). Method checks for open html tags, and makes sure to close them
Declaration
public IHtmlString Truncate(DynamicNull html, int length, bool addElipsis, bool treatTagsAsContent)
Parameters
Type |
Name |
Description |
DynamicNull |
html |
|
System.Int32 |
length |
|
System.Boolean |
addElipsis |
|
System.Boolean |
treatTagsAsContent |
|
Returns
Type |
Description |
System.Web.IHtmlString |
|
TruncateByWords(String, Int32)
Truncates a string to a given amount of words, can add a elipsis at the end (...). Method checks for open html tags, and makes sure to close them
Declaration
public IHtmlString TruncateByWords(string html, int words)
Parameters
Type |
Name |
Description |
System.String |
html |
|
System.Int32 |
words |
|
Returns
Type |
Description |
System.Web.IHtmlString |
|
TruncateByWords(String, Int32, Boolean)
Truncates a string to a given amount of words, can add a elipsis at the end (...). Method checks for open html tags, and makes sure to close them
Declaration
public IHtmlString TruncateByWords(string html, int words, bool addElipsis)
Parameters
Type |
Name |
Description |
System.String |
html |
|
System.Int32 |
words |
|
System.Boolean |
addElipsis |
|
Returns
Type |
Description |
System.Web.IHtmlString |
|
TruncateByWords(IHtmlString, Int32)
Truncates a string to a given amount of words, can add a elipsis at the end (...). Method checks for open html tags, and makes sure to close them
Declaration
public IHtmlString TruncateByWords(IHtmlString html, int words)
Parameters
Type |
Name |
Description |
System.Web.IHtmlString |
html |
|
System.Int32 |
words |
|
Returns
Type |
Description |
System.Web.IHtmlString |
|
TruncateByWords(IHtmlString, Int32, Boolean)
Truncates a string to a given amount of words, can add a elipsis at the end (...). Method checks for open html tags, and makes sure to close them
Declaration
public IHtmlString TruncateByWords(IHtmlString html, int words, bool addElipsis)
Parameters
Type |
Name |
Description |
System.Web.IHtmlString |
html |
|
System.Int32 |
words |
|
System.Boolean |
addElipsis |
|
Returns
Type |
Description |
System.Web.IHtmlString |
|
TypedContent(IEnumerable<Int32>)
Gets the contents corresponding to the identifiers.
Declaration
public IEnumerable<IPublishedContent> TypedContent(IEnumerable<int> ids)
Parameters
Type |
Name |
Description |
System.Collections.Generic.IEnumerable<System.Int32> |
ids |
The content identifiers.
|
Returns
Type |
Description |
System.Collections.Generic.IEnumerable<IPublishedContent> |
The existing contents corresponding to the identifiers.
|
TypedContent(IEnumerable<Object>)
Gets the contents corresponding to the identifiers.
Declaration
public IEnumerable<IPublishedContent> TypedContent(IEnumerable<object> ids)
Parameters
Type |
Name |
Description |
System.Collections.Generic.IEnumerable<System.Object> |
ids |
The content identifiers.
|
Returns
Type |
Description |
System.Collections.Generic.IEnumerable<IPublishedContent> |
The existing contents corresponding to the identifiers.
|
TypedContent(IEnumerable<String>)
Gets the contents corresponding to the identifiers.
Declaration
public IEnumerable<IPublishedContent> TypedContent(IEnumerable<string> ids)
Parameters
Type |
Name |
Description |
System.Collections.Generic.IEnumerable<System.String> |
ids |
The content identifiers.
|
Returns
Type |
Description |
System.Collections.Generic.IEnumerable<IPublishedContent> |
The existing contents corresponding to the identifiers.
|
TypedContent(Guid)
Gets a content item from the cache.
Declaration
public IPublishedContent TypedContent(Guid id)
Parameters
Type |
Name |
Description |
System.Guid |
id |
The key of the content item.
|
Returns
Type |
Description |
IPublishedContent |
The content, or null of the content item is not in the cache.
|
TypedContent(Guid[])
Gets content items from the cache.
Declaration
public IEnumerable<IPublishedContent> TypedContent(params Guid[] ids)
Parameters
Type |
Name |
Description |
System.Guid[] |
ids |
The keys of the content items.
|
Returns
Type |
Description |
System.Collections.Generic.IEnumerable<IPublishedContent> |
The content items that were found in the cache.
|
TypedContent(Int32)
Gets a content item from the cache.
Declaration
public IPublishedContent TypedContent(int id)
Parameters
Type |
Name |
Description |
System.Int32 |
id |
The unique identifier of the content item.
|
Returns
Type |
Description |
IPublishedContent |
The content, or null of the content item is not in the cache.
|
TypedContent(Int32[])
Gets content items from the cache.
Declaration
public IEnumerable<IPublishedContent> TypedContent(params int[] ids)
Parameters
Type |
Name |
Description |
System.Int32[] |
ids |
The unique identifiers of the content items.
|
Returns
Type |
Description |
System.Collections.Generic.IEnumerable<IPublishedContent> |
The content items that were found in the cache.
|
TypedContent(Object)
Gets a content item from the cache.
Declaration
public IPublishedContent TypedContent(object id)
Parameters
Type |
Name |
Description |
System.Object |
id |
The unique identifier, or the key, of the content item.
|
Returns
Type |
Description |
IPublishedContent |
The content, or null of the content item is not in the cache.
|
TypedContent(Object[])
Gets content items from the cache.
Declaration
public IEnumerable<IPublishedContent> TypedContent(params object[] ids)
Parameters
Type |
Name |
Description |
System.Object[] |
ids |
The unique identifiers, or the keys, of the content items.
|
Returns
Type |
Description |
System.Collections.Generic.IEnumerable<IPublishedContent> |
The content items that were found in the cache.
|
TypedContent(String)
Gets a content item from the cache.
Declaration
public IPublishedContent TypedContent(string id)
Parameters
Type |
Name |
Description |
System.String |
id |
The unique identifier, or the key, of the content item.
|
Returns
Type |
Description |
IPublishedContent |
The content, or null of the content item is not in the cache.
|
TypedContent(String[])
Gets content items from the cache.
Declaration
public IEnumerable<IPublishedContent> TypedContent(params string[] ids)
Parameters
Type |
Name |
Description |
System.String[] |
ids |
The unique identifiers, or the keys, of the content items.
|
Returns
Type |
Description |
System.Collections.Generic.IEnumerable<IPublishedContent> |
The content items that were found in the cache.
|
TypedContent(Udi)
Gets a content item from the cache
Declaration
public IPublishedContent TypedContent(Udi id)
Parameters
Type |
Name |
Description |
Udi |
id |
|
Returns
TypedContentAtRoot()
Declaration
public IEnumerable<IPublishedContent> TypedContentAtRoot()
Returns
TypedContentAtXPath(String, XPathVariable[])
Declaration
public IEnumerable<IPublishedContent> TypedContentAtXPath(string xpath, params XPathVariable[] vars)
Parameters
Returns
TypedContentAtXPath(XPathExpression, XPathVariable[])
Declaration
public IEnumerable<IPublishedContent> TypedContentAtXPath(XPathExpression xpath, params XPathVariable[] vars)
Parameters
Type |
Name |
Description |
System.Xml.XPath.XPathExpression |
xpath |
|
XPathVariable[] |
vars |
|
Returns
TypedContentSingleAtXPath(String, XPathVariable[])
Declaration
public IPublishedContent TypedContentSingleAtXPath(string xpath, params XPathVariable[] vars)
Parameters
Returns
Gets the medias corresponding to the identifiers.
Declaration
public IEnumerable<IPublishedContent> TypedMedia(IEnumerable<int> ids)
Parameters
Type |
Name |
Description |
System.Collections.Generic.IEnumerable<System.Int32> |
ids |
The media identifiers.
|
Returns
Type |
Description |
System.Collections.Generic.IEnumerable<IPublishedContent> |
The existing medias corresponding to the identifiers.
|
Gets the medias corresponding to the identifiers.
Declaration
public IEnumerable<IPublishedContent> TypedMedia(IEnumerable<object> ids)
Parameters
Type |
Name |
Description |
System.Collections.Generic.IEnumerable<System.Object> |
ids |
The media identifiers.
|
Returns
Type |
Description |
System.Collections.Generic.IEnumerable<IPublishedContent> |
The existing medias corresponding to the identifiers.
|
Gets the medias corresponding to the identifiers.
Declaration
public IEnumerable<IPublishedContent> TypedMedia(IEnumerable<string> ids)
Parameters
Type |
Name |
Description |
System.Collections.Generic.IEnumerable<System.String> |
ids |
The media identifiers.
|
Returns
Type |
Description |
System.Collections.Generic.IEnumerable<IPublishedContent> |
The existing medias corresponding to the identifiers.
|
Declaration
public IPublishedContent TypedMedia(Guid id)
Parameters
Type |
Name |
Description |
System.Guid |
id |
|
Returns
Declaration
public IPublishedContent TypedMedia(int id)
Parameters
Type |
Name |
Description |
System.Int32 |
id |
|
Returns
Gets the medias corresponding to the identifiers.
Declaration
public IEnumerable<IPublishedContent> TypedMedia(params int[] ids)
Parameters
Type |
Name |
Description |
System.Int32[] |
ids |
The media identifiers.
|
Returns
Type |
Description |
System.Collections.Generic.IEnumerable<IPublishedContent> |
The existing medias corresponding to the identifiers.
|
Overloaded method accepting an 'object' type
Declaration
public IPublishedContent TypedMedia(object id)
Parameters
Type |
Name |
Description |
System.Object |
id |
|
Returns
Gets the medias corresponding to the identifiers.
Declaration
public IEnumerable<IPublishedContent> TypedMedia(params object[] ids)
Parameters
Type |
Name |
Description |
System.Object[] |
ids |
The media identifiers.
|
Returns
Type |
Description |
System.Collections.Generic.IEnumerable<IPublishedContent> |
The existing medias corresponding to the identifiers.
|
Declaration
public IPublishedContent TypedMedia(string id)
Parameters
Type |
Name |
Description |
System.String |
id |
|
Returns
Gets the medias corresponding to the identifiers.
Declaration
public IEnumerable<IPublishedContent> TypedMedia(params string[] ids)
Parameters
Type |
Name |
Description |
System.String[] |
ids |
The media identifiers.
|
Returns
Type |
Description |
System.Collections.Generic.IEnumerable<IPublishedContent> |
The existing medias corresponding to the identifiers.
|
Declaration
public IPublishedContent TypedMedia(Udi id)
Parameters
Type |
Name |
Description |
Udi |
id |
|
Returns
Declaration
public IEnumerable<IPublishedContent> TypedMediaAtRoot()
Returns
TypedMember(Guid)
Declaration
public IPublishedContent TypedMember(Guid id)
Parameters
Type |
Name |
Description |
System.Guid |
id |
|
Returns
TypedMember(Int32)
Declaration
public IPublishedContent TypedMember(int id)
Parameters
Type |
Name |
Description |
System.Int32 |
id |
|
Returns
TypedMember(Object)
Declaration
public IPublishedContent TypedMember(object id)
Parameters
Type |
Name |
Description |
System.Object |
id |
|
Returns
TypedMember(String)
Declaration
public IPublishedContent TypedMember(string id)
Parameters
Type |
Name |
Description |
System.String |
id |
|
Returns
TypedMember(Udi)
Declaration
public IPublishedContent TypedMember(Udi id)
Parameters
Type |
Name |
Description |
Udi |
id |
|
Returns
TypedSearch(ISearchCriteria, BaseSearchProvider)
Declaration
public IEnumerable<IPublishedContent> TypedSearch(ISearchCriteria criteria, BaseSearchProvider searchProvider = null)
Parameters
Type |
Name |
Description |
Examine.SearchCriteria.ISearchCriteria |
criteria |
|
Examine.Providers.BaseSearchProvider |
searchProvider |
|
Returns
TypedSearch(Int32, Int32, out Int32, ISearchCriteria, BaseSearchProvider)
Declaration
public IEnumerable<IPublishedContent> TypedSearch(int skip, int take, out int totalRecords, ISearchCriteria criteria, BaseSearchProvider searchProvider = null)
Parameters
Type |
Name |
Description |
System.Int32 |
skip |
|
System.Int32 |
take |
|
System.Int32 |
totalRecords |
|
Examine.SearchCriteria.ISearchCriteria |
criteria |
|
Examine.Providers.BaseSearchProvider |
searchProvider |
|
Returns
TypedSearch(Int32, Int32, out Int32, String, Boolean, String)
Declaration
public IEnumerable<IPublishedContent> TypedSearch(int skip, int take, out int totalRecords, string term, bool useWildCards = true, string searchProvider = null)
Parameters
Type |
Name |
Description |
System.Int32 |
skip |
|
System.Int32 |
take |
|
System.Int32 |
totalRecords |
|
System.String |
term |
|
System.Boolean |
useWildCards |
|
System.String |
searchProvider |
|
Returns
TypedSearch(String, Boolean, String)
Declaration
public IEnumerable<IPublishedContent> TypedSearch(string term, bool useWildCards = true, string searchProvider = null)
Parameters
Type |
Name |
Description |
System.String |
term |
|
System.Boolean |
useWildCards |
|
System.String |
searchProvider |
|
Returns
Url(Int32)
Gets the url of a content identified by its identifier.
Declaration
public string Url(int contentId)
Parameters
Type |
Name |
Description |
System.Int32 |
contentId |
The content identifier.
|
Returns
Type |
Description |
System.String |
The url for the content.
|
Url(Int32, UrlProviderMode)
Gets the url of a content identified by its identifier, in a specified mode.
Declaration
public string Url(int contentId, UrlProviderMode mode)
Parameters
Type |
Name |
Description |
System.Int32 |
contentId |
The content identifier.
|
UrlProviderMode |
mode |
The mode.
|
Returns
Type |
Description |
System.String |
The url for the content.
|
UrlAbsolute(Int32)
Gets the absolute url of a content identified by its identifier.
Declaration
public string UrlAbsolute(int contentId)
Parameters
Type |
Name |
Description |
System.Int32 |
contentId |
The content identifier.
|
Returns
Type |
Description |
System.String |
The absolute url for the content.
|