Class ElementPublishStatusService
Implements IElementPublishStatusQueryService and IElementPublishStatusManagementService verifying and managing the published status of elements.
Namespace: Umbraco.Cms.Core.Services.Navigation
Assembly: Umbraco.Core.dll
Syntax
public class ElementPublishStatusService : PublishStatusService, IElementPublishStatusQueryService, IElementPublishStatusManagementService
Constructors
View SourceElementPublishStatusService(ILogger<ElementPublishStatusService>, IPublishStatusRepository, ICoreScopeProvider, ILanguageService)
Initializes a new instance of the ElementPublishStatusService class.
Declaration
public ElementPublishStatusService(ILogger<ElementPublishStatusService> logger, IPublishStatusRepository publishStatusRepository, ICoreScopeProvider coreScopeProvider, ILanguageService languageService)
Parameters
| Type | Name | Description |
|---|---|---|
| ILogger<ElementPublishStatusService> | logger | The logger for diagnostic output. |
| IPublishStatusRepository | publishStatusRepository | The repository for accessing element publish status data. |
| ICoreScopeProvider | coreScopeProvider | The provider for creating database scopes. |
| ILanguageService | languageService | The service for retrieving language information. |
Methods
View SourceAddOrUpdateStatusAsync(Guid, CancellationToken)
Adds or updates the publish status for a specific element in the cache.
Declaration
public Task AddOrUpdateStatusAsync(Guid elementKey, CancellationToken cancellationToken)
Parameters
| Type | Name | Description |
|---|---|---|
| Guid | elementKey | The unique key of the element to update. |
| CancellationToken | cancellationToken | A token to cancel the operation. |
Returns
| Type | Description |
|---|---|
| Task | A task that represents the asynchronous operation. |
InitializeAsync(CancellationToken)
Initializes the element publish status cache by loading all published element statuses from the database.
Declaration
public Task InitializeAsync(CancellationToken cancellationToken)
Parameters
| Type | Name | Description |
|---|---|---|
| CancellationToken | cancellationToken | A token to cancel the operation. |
Returns
| Type | Description |
|---|---|
| Task | A task that represents the asynchronous initialization operation. |
IsPublished(Guid, string)
Checks if an element is published in a specific culture.
Declaration
public bool IsPublished(Guid elementKey, string culture)
Parameters
| Type | Name | Description |
|---|---|---|
| Guid | elementKey | The element's key. |
| string | culture | The culture. |
Returns
| Type | Description |
|---|---|
| bool | True if element is published in the specified culture. |
IsPublishedInAnyCulture(Guid)
Checks if an element is published in any culture.
Declaration
public bool IsPublishedInAnyCulture(Guid elementKey)
Parameters
| Type | Name | Description |
|---|---|---|
| Guid | elementKey | The element's key. |
Returns
| Type | Description |
|---|---|
| bool | True if element has any published culture. |
RemoveAsync(Guid, CancellationToken)
Removes an element from the publish status cache.
Declaration
public Task RemoveAsync(Guid elementKey, CancellationToken cancellationToken)
Parameters
| Type | Name | Description |
|---|---|---|
| Guid | elementKey | The unique key of the element to remove. |
| CancellationToken | cancellationToken | A token to cancel the operation. |
Returns
| Type | Description |
|---|---|
| Task | A task that represents the asynchronous operation. |