Class IContentExtensions
Extends IContent with some convenient methods.
Inheritance
Inherited Members
Namespace: EPiServer.Core
Assembly: EPiServer.dll
Version: 7.19.2Syntax
public static class IContentExtensionsMethods
GetPropertyName<TContent>(TContent, Expression<Func<TContent, Object>>)
Gets the property name from the expression.
Declaration
public static string GetPropertyName<TContent>(this TContent content, Expression<Func<TContent, object>> expression)
    where TContent : IContentDataParameters
| Type | Name | Description | 
|---|---|---|
| TContent | content | The content containing the property definition. | 
| System.Linq.Expressions.Expression<System.Func<TContent, System.Object>> | expression | The expression to get the property name. The expression needs to be a member expression or a unary expression. | 
Returns
| Type | Description | 
|---|---|
| System.String | Name of the property | 
Type Parameters
| Name | Description | 
|---|---|
| TContent | The content type. | 
QueryAccess(IContent)
Return the access level that the current user has to the content
Declaration
public static AccessLevel QueryAccess(this IContent content)Parameters
| Type | Name | Description | 
|---|---|---|
| IContent | content | The content. | 
Returns
| Type | Description | 
|---|---|
| AccessLevel | An AccessLevel | 
Remarks
Note that this method also checks the published status of the page to determine the actual access that the user has. I e if the page is not published the user will not see it unless he has "more" access than Read.
QueryDistinctAccess(IContent, AccessLevel)
Check for a distinct required access level. This is preferred to use over QueryAccess for performance reasons.
Declaration
public static bool QueryDistinctAccess(this IContent content, AccessLevel requestedLevel)Parameters
| Type | Name | Description | 
|---|---|---|
| IContent | content | The content. | 
| AccessLevel | requestedLevel | The requested level. | 
Returns
| Type | Description | 
|---|---|
| System.Boolean | true if at least the requested access is held by the current user | 
Remarks
This method is optimized for speed, by checking preconditions before calling expensive methods.
