Interface IDocumentRepository
Represents a repository for IContent document entities.
Namespace: Umbraco.Cms.Core.Persistence.Repositories
Assembly: Umbraco.Core.dll
Syntax
public interface IDocumentRepository : IContentRepository<int, IContent>, IReadWriteQueryRepository<int, IContent>, IReadRepository<int, IContent>, IWriteRepository<IContent>, IQueryRepository<IContent>, IReadRepository<Guid, IContent>, IRepository
Methods
View SourceAddOrUpdatePermissions(ContentPermissionSet)
Used to add/update a permission for a content item
Declaration
void AddOrUpdatePermissions(ContentPermissionSet permission)
Parameters
| Type | Name | Description |
|---|---|---|
| ContentPermissionSet | permission |
AssignEntityPermission(IContent, string, IEnumerable<int>)
Assigns a single permission to the current content item for the specified user group ids
Declaration
void AssignEntityPermission(IContent entity, string permission, IEnumerable<int> groupIds)
Parameters
| Type | Name | Description |
|---|---|---|
| IContent | entity | |
| string | permission | |
| IEnumerable<int> | groupIds |
ClearSchedule(DateTime)
Clears the publishing schedule for all entries having an a date before (lower than, or equal to) a specified date.
Declaration
void ClearSchedule(DateTime date)
Parameters
| Type | Name | Description |
|---|---|---|
| DateTime | date | The cutoff date. |
ClearSchedule(DateTime, ContentScheduleAction)
Clears the publishing schedule for entries matching the specified action and having a date before the specified date.
Declaration
void ClearSchedule(DateTime date, ContentScheduleAction action)
Parameters
| Type | Name | Description |
|---|---|---|
| DateTime | date | The cutoff date. |
| ContentScheduleAction | action | The schedule action to clear. |
CountPublished(string?)
Get the count of published items
Declaration
int CountPublished(string? contentTypeAlias = null)
Parameters
| Type | Name | Description |
|---|---|---|
| string | contentTypeAlias |
Returns
| Type | Description |
|---|---|
| int |
Remarks
We require this on the repo because the IQuery{IContent} cannot supply the 'newest' parameter
GetContentForExpiration(DateTime)
Gets IContent objects having an expiration date before (lower than, or equal to) a specified date.
Declaration
IEnumerable<IContent> GetContentForExpiration(DateTime date)
Parameters
| Type | Name | Description |
|---|---|---|
| DateTime | date |
Returns
| Type | Description |
|---|---|
| IEnumerable<IContent> |
Remarks
The content returned from this method may be culture variant, in which case you can use GetStatus(IContent, ContentScheduleCollection, string?) to get the status for a specific culture.
GetContentForRelease(DateTime)
Gets IContent objects having a release date before (lower than, or equal to) a specified date.
Declaration
IEnumerable<IContent> GetContentForRelease(DateTime date)
Parameters
| Type | Name | Description |
|---|---|---|
| DateTime | date |
Returns
| Type | Description |
|---|---|
| IEnumerable<IContent> |
Remarks
The content returned from this method may be culture variant, in which case you can use GetStatus(IContent, ContentScheduleCollection, string?) to get the status for a specific culture.
GetContentSchedule(int)
Gets publish/unpublish schedule for a content node.
Declaration
ContentScheduleCollection GetContentSchedule(int contentId)
Parameters
| Type | Name | Description |
|---|---|---|
| int | contentId |
Returns
| Type | Description |
|---|---|
| ContentScheduleCollection |
GetContentSchedulesByIds(int[])
Gets the content keys from the provided collection of keys that are scheduled for publishing.
Declaration
IDictionary<int, IEnumerable<ContentSchedule>> GetContentSchedulesByIds(int[] documentIds)
Parameters
| Type | Name | Description |
|---|---|---|
| int[] | documentIds | The IDs of the documents. |
Returns
| Type | Description |
|---|---|
| IDictionary<int, IEnumerable<ContentSchedule>> | The provided collection of content keys filtered for those that are scheduled for publishing. |
GetPage(IQuery<IContent>?, long, int, out long, string[]?, IQuery<IContent>?, Ordering?, bool)
Gets paged documents.
Declaration
IEnumerable<IContent> GetPage(IQuery<IContent>? query, long pageIndex, int pageSize, out long totalRecords, string[]? propertyAliases, IQuery<IContent>? filter, Ordering? ordering, bool loadTemplates)
Parameters
| Type | Name | Description |
|---|---|---|
| IQuery<IContent> | query | The base query for documents. |
| long | pageIndex | The page index (zero-based). |
| int | pageSize | The number of items per page. |
| long | totalRecords | Output parameter with total record count. |
| string[] | propertyAliases | Optional array of property aliases to load. If null, all properties are loaded. If empty array, no custom properties are loaded (only system properties). |
| IQuery<IContent> | filter | Optional filter query. |
| Ordering | ordering | The ordering specification. |
| bool | loadTemplates | Whether to load templates. Set to false for performance optimization when templates are not needed (e.g., collection views). Default is true. |
Returns
| Type | Description |
|---|---|
| IEnumerable<IContent> | A collection of documents for the specified page. |
Remarks
Here, filter can be null but ordering cannot.
GetPermissionsForEntity(int)
Gets the explicit list of permissions for the content item
Declaration
EntityPermissionCollection GetPermissionsForEntity(int entityId)
Parameters
| Type | Name | Description |
|---|---|---|
| int | entityId |
Returns
| Type | Description |
|---|---|
| EntityPermissionCollection |
HasContentForExpiration(DateTime)
Checks whether there is content scheduled for expiration before the specified date.
Declaration
bool HasContentForExpiration(DateTime date)
Parameters
| Type | Name | Description |
|---|---|---|
| DateTime | date | The date to check. |
Returns
| Type | Description |
|---|---|
| bool |
|
HasContentForRelease(DateTime)
Checks whether there is content scheduled for release before the specified date.
Declaration
bool HasContentForRelease(DateTime date)
Parameters
| Type | Name | Description |
|---|---|---|
| DateTime | date | The date to check. |
Returns
| Type | Description |
|---|---|
| bool |
|
IsPathPublished(IContent?)
Checks whether the path to a content item is published.
Declaration
bool IsPathPublished(IContent? content)
Parameters
| Type | Name | Description |
|---|---|---|
| IContent | content | The content item. |
Returns
| Type | Description |
|---|---|
| bool |
|
PersistContentSchedule(IContent, ContentScheduleCollection)
Persists publish/unpublish schedule for a content node.
Declaration
void PersistContentSchedule(IContent content, ContentScheduleCollection schedule)
Parameters
| Type | Name | Description |
|---|---|---|
| IContent | content | |
| ContentScheduleCollection | schedule |
RecycleBinSmells()
Returns true if there is any content in the recycle bin
Declaration
bool RecycleBinSmells()
Returns
| Type | Description |
|---|---|
| bool |
ReplaceContentPermissions(EntityPermissionSet)
Used to bulk update the permissions set for a content item. This will replace all permissions assigned to an entity with a list of user id & permission pairs.
Declaration
void ReplaceContentPermissions(EntityPermissionSet permissionSet)
Parameters
| Type | Name | Description |
|---|---|---|
| EntityPermissionSet | permissionSet |