View Source
Class ContentTypeServiceBase<TRepository, TItem>
Assembly: Umbraco.Core.dll
Syntax
public abstract class ContentTypeServiceBase<TRepository, TItem> : ContentTypeServiceBase, IContentTypeBaseService<TItem>, IContentTypeBaseService, IService where TRepository : IContentTypeRepositoryBase<TItem> where TItem : class, IContentTypeComposition
Type Parameters
| Name |
Description |
| TRepository |
|
| TItem |
|
Constructors
View Source
ContentTypeServiceBase(ICoreScopeProvider, ILoggerFactory, IEventMessagesFactory, TRepository, IAuditRepository, IEntityContainerRepository, IEntityRepository, IEventAggregator, IUserIdKeyResolver, ContentTypeFilterCollection)
Declaration
[Obsolete("Use the non-obsolete constructor instead. Scheduled removal in v19.")]
protected ContentTypeServiceBase(ICoreScopeProvider provider, ILoggerFactory loggerFactory, IEventMessagesFactory eventMessagesFactory, TRepository repository, IAuditRepository auditRepository, IEntityContainerRepository containerRepository, IEntityRepository entityRepository, IEventAggregator eventAggregator, IUserIdKeyResolver userIdKeyResolver, ContentTypeFilterCollection contentTypeFilters)
Parameters
View Source
ContentTypeServiceBase(ICoreScopeProvider, ILoggerFactory, IEventMessagesFactory, TRepository, IAuditService, IEntityContainerRepository, IEntityRepository, IEventAggregator, IUserIdKeyResolver, ContentTypeFilterCollection)
Declaration
protected ContentTypeServiceBase(ICoreScopeProvider provider, ILoggerFactory loggerFactory, IEventMessagesFactory eventMessagesFactory, TRepository repository, IAuditService auditService, IEntityContainerRepository containerRepository, IEntityRepository entityRepository, IEventAggregator eventAggregator, IUserIdKeyResolver userIdKeyResolver, ContentTypeFilterCollection contentTypeFilters)
Parameters
Properties
View Source
ContainedObjectType
Declaration
protected abstract Guid ContainedObjectType { get; }
Property Value
View Source
ContainerObjectType
Declaration
protected Guid ContainerObjectType { get; }
Property Value
View Source
ReadLockIds
Declaration
protected abstract int[] ReadLockIds { get; }
Property Value
View Source
Repository
Declaration
protected TRepository Repository { get; }
Property Value
| Type |
Description |
| TRepository |
|
View Source
WriteLockIds
Declaration
protected abstract int[] WriteLockIds { get; }
Property Value
Methods
View Source
CanDelete(TItem)
Declaration
protected virtual bool CanDelete(TItem item)
Parameters
| Type |
Name |
Description |
| TItem |
item |
|
Returns
View Source
Copy(TItem, int)
Declaration
[Obsolete("Please use CopyAsync. Will be removed in V16.")]
public Attempt<OperationResult<MoveOperationStatusType, TItem>?> Copy(TItem copying, int containerId)
Parameters
| Type |
Name |
Description |
| TItem |
copying |
|
| int |
containerId |
|
Returns
View Source
Copy(TItem, string, string, int)
Declaration
[Obsolete("Please use CopyAsync. Will be removed in V15.")]
public TItem Copy(TItem original, string alias, string name, int parentId = -1)
Parameters
| Type |
Name |
Description |
| TItem |
original |
|
| string |
alias |
|
| string |
name |
|
| int |
parentId |
|
Returns
View Source
Copy(TItem, string, string, TItem?)
Declaration
[Obsolete("Please use CopyAsync. Will be removed in V15.")]
public TItem Copy(TItem original, string alias, string name, TItem? parent)
Parameters
| Type |
Name |
Description |
| TItem |
original |
|
| string |
alias |
|
| string |
name |
|
| TItem |
parent |
|
Returns
View Source
CopyAsync(Guid, Guid?)
Declaration
public Task<Attempt<TItem?, ContentTypeStructureOperationStatus>> CopyAsync(Guid key, Guid? containerKey)
Parameters
| Type |
Name |
Description |
| Guid |
key |
|
| Guid? |
containerKey |
|
Returns
View Source
Count()
Declaration
Returns
View Source
CreateAsync(TItem, Guid)
Declaration
public Task<Attempt<ContentTypeOperationStatus>> CreateAsync(TItem item, Guid performingUserKey)
Parameters
| Type |
Name |
Description |
| TItem |
item |
|
| Guid |
performingUserKey |
|
Returns
View Source
CreateContainer(int, Guid, string, int)
Declaration
[Obsolete("Please use IContentTypeContainerService or IMediaTypeContainerService for all content or media type container operations. Will be removed in V16.")]
public Attempt<OperationResult<OperationResultType, EntityContainer>?> CreateContainer(int parentId, Guid key, string name, int userId = -1)
Parameters
| Type |
Name |
Description |
| int |
parentId |
|
| Guid |
key |
|
| string |
name |
|
| int |
userId |
|
Returns
View Source
Delete(IEnumerable<TItem>, int)
Declaration
public void Delete(IEnumerable<TItem> items, int userId = -1)
Parameters
| Type |
Name |
Description |
| IEnumerable<TItem> |
items |
|
| int |
userId |
|
View Source
Delete(TItem, int)
Declaration
public void Delete(TItem item, int userId = -1)
Parameters
| Type |
Name |
Description |
| TItem |
item |
|
| int |
userId |
|
View Source
DeleteAsync(Guid, Guid)
Declaration
public Task<ContentTypeOperationStatus> DeleteAsync(Guid key, Guid performingUserKey)
Parameters
| Type |
Name |
Description |
| Guid |
key |
The item to delete.
|
| Guid |
performingUserKey |
|
Returns
View Source
DeleteContainer(int, int)
Declaration
[Obsolete("Please use IContentTypeContainerService or IMediaTypeContainerService for all content or media type container operations. Will be removed in V16.")]
public Attempt<OperationResult?> DeleteContainer(int containerId, int userId = -1)
Parameters
| Type |
Name |
Description |
| int |
containerId |
|
| int |
userId |
|
Returns
View Source
DeleteItemsOfTypes(IEnumerable<int>)
Declaration
protected abstract void DeleteItemsOfTypes(IEnumerable<int> typeIds)
Parameters
| Type |
Name |
Description |
| IEnumerable<int> |
typeIds |
|
View Source
Get(Guid)
Declaration
public TItem? Get(Guid id)
Parameters
| Type |
Name |
Description |
| Guid |
id |
|
Returns
View Source
Get(int)
Declaration
public TItem? Get(int id)
Parameters
| Type |
Name |
Description |
| int |
id |
|
Returns
View Source
Get(string)
Declaration
public TItem? Get(string alias)
Parameters
| Type |
Name |
Description |
| string |
alias |
|
Returns
View Source
GetAll()
Declaration
public IEnumerable<TItem> GetAll()
Returns
| Type |
Description |
| IEnumerable<TItem> |
|
View Source
GetAllAllowedAsRootAsync(int, int)
Returns all the content type allowed as root.
Declaration
public Task<PagedModel<TItem>> GetAllAllowedAsRootAsync(int skip, int take)
Parameters
| Type |
Name |
Description |
| int |
skip |
|
| int |
take |
|
Returns
View Source
GetAllowedChildrenAsync(Guid, int, int)
Returns all content types allowed as children for a given content type key.
Declaration
public Task<Attempt<PagedModel<TItem>?, ContentTypeOperationStatus>> GetAllowedChildrenAsync(Guid key, int skip, int take)
Parameters
| Type |
Name |
Description |
| Guid |
key |
The content type key.
|
| int |
skip |
|
| int |
take |
|
Returns
View Source
GetAllowedChildrenAsync(Guid, Guid?, int, int)
Returns all content types allowed as children for a given content type key.
Declaration
public Task<Attempt<PagedModel<TItem>?, ContentTypeOperationStatus>> GetAllowedChildrenAsync(Guid key, Guid? parentContentKey, int skip, int take)
Parameters
| Type |
Name |
Description |
| Guid |
key |
The content type key.
|
| Guid? |
parentContentKey |
The parent content key.
|
| int |
skip |
|
| int |
take |
|
Returns
View Source
GetAsync(Guid)
Declaration
public Task<TItem?> GetAsync(Guid guid)
Parameters
| Type |
Name |
Description |
| Guid |
guid |
The key of the content type.
|
Returns
| Type |
Description |
| Task<TItem> |
The found content type, null if none was found.
|
View Source
GetChildren(Guid)
Declaration
public IEnumerable<TItem> GetChildren(Guid id)
Parameters
| Type |
Name |
Description |
| Guid |
id |
|
Returns
| Type |
Description |
| IEnumerable<TItem> |
|
View Source
GetChildren(int)
Declaration
public IEnumerable<TItem> GetChildren(int id)
Parameters
| Type |
Name |
Description |
| int |
id |
|
Returns
| Type |
Description |
| IEnumerable<TItem> |
|
View Source
GetComposedOf(int)
Declaration
public IEnumerable<TItem> GetComposedOf(int id)
Parameters
| Type |
Name |
Description |
| int |
id |
|
Returns
| Type |
Description |
| IEnumerable<TItem> |
|
View Source
GetComposedOf(int, IEnumerable<TItem>)
Declaration
public IEnumerable<TItem> GetComposedOf(int id, IEnumerable<TItem> all)
Parameters
| Type |
Name |
Description |
| int |
id |
|
| IEnumerable<TItem> |
all |
|
Returns
| Type |
Description |
| IEnumerable<TItem> |
|
View Source
GetContainer(Guid)
Declaration
[Obsolete("Please use IContentTypeContainerService or IMediaTypeContainerService for all content or media type container operations. Will be removed in V16.")]
public EntityContainer? GetContainer(Guid containerId)
Parameters
| Type |
Name |
Description |
| Guid |
containerId |
|
Returns
View Source
GetContainer(int)
Declaration
[Obsolete("Please use IContentTypeContainerService or IMediaTypeContainerService for all content or media type container operations. Will be removed in V16.")]
public EntityContainer? GetContainer(int containerId)
Parameters
| Type |
Name |
Description |
| int |
containerId |
|
Returns
View Source
GetContainers(int[])
Declaration
[Obsolete("Please use IContentTypeContainerService or IMediaTypeContainerService for all content or media type container operations. Will be removed in V16.")]
public IEnumerable<EntityContainer> GetContainers(int[] containerIds)
Parameters
| Type |
Name |
Description |
| int[] |
containerIds |
|
Returns
View Source
GetContainers(string, int)
Declaration
[Obsolete("Please use IContentTypeContainerService or IMediaTypeContainerService for all content or media type container operations. Will be removed in V16.")]
public IEnumerable<EntityContainer> GetContainers(string name, int level)
Parameters
| Type |
Name |
Description |
| string |
name |
|
| int |
level |
|
Returns
View Source
GetContainers(TItem)
Declaration
[Obsolete("Please use IContentTypeContainerService or IMediaTypeContainerService for all content or media type container operations. Will be removed in V16.")]
public IEnumerable<EntityContainer> GetContainers(TItem item)
Parameters
| Type |
Name |
Description |
| TItem |
item |
|
Returns
View Source
GetContentTypeChangedNotification(IEnumerable<ContentTypeChange<TItem>>, EventMessages)
Declaration
protected abstract ContentTypeChangeNotification<TItem> GetContentTypeChangedNotification(IEnumerable<ContentTypeChange<TItem>> changes, EventMessages eventMessages)
Parameters
Returns
View Source
GetContentTypeRefreshedNotification(IEnumerable<ContentTypeChange<TItem>>, EventMessages)
Declaration
protected abstract ContentTypeRefreshNotification<TItem> GetContentTypeRefreshedNotification(IEnumerable<ContentTypeChange<TItem>> changes, EventMessages eventMessages)
Parameters
Returns
View Source
GetDeletedNotification(IEnumerable<TItem>, EventMessages)
Declaration
protected abstract DeletedNotification<TItem> GetDeletedNotification(IEnumerable<TItem> items, EventMessages eventMessages)
Parameters
| Type |
Name |
Description |
| IEnumerable<TItem> |
items |
|
| EventMessages |
eventMessages |
|
Returns
View Source
GetDeletingNotification(IEnumerable<TItem>, EventMessages)
Declaration
protected abstract DeletingNotification<TItem> GetDeletingNotification(IEnumerable<TItem> items, EventMessages eventMessages)
Parameters
| Type |
Name |
Description |
| IEnumerable<TItem> |
items |
|
| EventMessages |
eventMessages |
|
Returns
View Source
GetDeletingNotification(TItem, EventMessages)
Declaration
protected abstract DeletingNotification<TItem> GetDeletingNotification(TItem item, EventMessages eventMessages)
Parameters
Returns
View Source
GetDescendants(int, bool)
Declaration
public IEnumerable<TItem> GetDescendants(int id, bool andSelf)
Parameters
| Type |
Name |
Description |
| int |
id |
|
| bool |
andSelf |
|
Returns
| Type |
Description |
| IEnumerable<TItem> |
|
View Source
GetMany(IEnumerable<Guid>?)
Declaration
public IEnumerable<TItem> GetMany(IEnumerable<Guid>? ids)
Parameters
| Type |
Name |
Description |
| IEnumerable<Guid> |
ids |
|
Returns
| Type |
Description |
| IEnumerable<TItem> |
|
View Source
GetMany(params int[])
Declaration
public IEnumerable<TItem> GetMany(params int[] ids)
Parameters
| Type |
Name |
Description |
| int[] |
ids |
|
Returns
| Type |
Description |
| IEnumerable<TItem> |
|
View Source
GetMovedNotification(IEnumerable<MoveEventInfo<TItem>>, EventMessages)
Declaration
protected abstract MovedNotification<TItem> GetMovedNotification(IEnumerable<MoveEventInfo<TItem>> moveInfo, EventMessages eventMessages)
Parameters
Returns
View Source
GetMovingNotification(MoveEventInfo<TItem>, EventMessages)
Declaration
protected abstract MovingNotification<TItem> GetMovingNotification(MoveEventInfo<TItem> moveInfo, EventMessages eventMessages)
Parameters
Returns
View Source
GetSavedNotification(IEnumerable<TItem>, EventMessages)
Declaration
protected abstract SavedNotification<TItem> GetSavedNotification(IEnumerable<TItem> items, EventMessages eventMessages)
Parameters
| Type |
Name |
Description |
| IEnumerable<TItem> |
items |
|
| EventMessages |
eventMessages |
|
Returns
View Source
GetSavedNotification(TItem, EventMessages)
Declaration
protected abstract SavedNotification<TItem> GetSavedNotification(TItem item, EventMessages eventMessages)
Parameters
Returns
View Source
GetSavingNotification(IEnumerable<TItem>, EventMessages)
Declaration
protected abstract SavingNotification<TItem> GetSavingNotification(IEnumerable<TItem> items, EventMessages eventMessages)
Parameters
| Type |
Name |
Description |
| IEnumerable<TItem> |
items |
|
| EventMessages |
eventMessages |
|
Returns
View Source
GetSavingNotification(TItem, EventMessages)
Declaration
protected abstract SavingNotification<TItem> GetSavingNotification(TItem item, EventMessages eventMessages)
Parameters
Returns
View Source
HasChildren(Guid)
Declaration
public bool HasChildren(Guid id)
Parameters
| Type |
Name |
Description |
| Guid |
id |
|
Returns
View Source
HasChildren(int)
Declaration
public bool HasChildren(int id)
Parameters
| Type |
Name |
Description |
| int |
id |
|
Returns
View Source
HasContainerInPath(params int[])
Gets a value indicating whether there is a list view content item in the path.
Declaration
public bool HasContainerInPath(params int[] ids)
Parameters
| Type |
Name |
Description |
| int[] |
ids |
|
Returns
View Source
HasContainerInPath(string)
Given the path of a content item, this will return true if the content item exists underneath a list view content item
Declaration
public bool HasContainerInPath(string contentPath)
Parameters
| Type |
Name |
Description |
| string |
contentPath |
|
Returns
View Source
HasContentNodes(int)
Returns true or false depending on whether content nodes have been created based on the provided content type id.
Declaration
public bool HasContentNodes(int id)
Parameters
| Type |
Name |
Description |
| int |
id |
|
Returns
View Source
Move(TItem, int)
Declaration
[Obsolete("Please use MoveAsync. Will be removed in V16.")]
public Attempt<OperationResult<MoveOperationStatusType>?> Move(TItem moving, int containerId)
Parameters
| Type |
Name |
Description |
| TItem |
moving |
|
| int |
containerId |
|
Returns
View Source
MoveAsync(Guid, Guid?)
Declaration
public Task<Attempt<TItem?, ContentTypeStructureOperationStatus>> MoveAsync(Guid key, Guid? containerKey)
Parameters
| Type |
Name |
Description |
| Guid |
key |
|
| Guid? |
containerKey |
|
Returns
View Source
RenameContainer(int, string, int)
Declaration
[Obsolete("Please use IContentTypeContainerService or IMediaTypeContainerService for all content or media type container operations. Will be removed in V16.")]
public Attempt<OperationResult<OperationResultType, EntityContainer>?> RenameContainer(int id, string name, int userId = -1)
Parameters
| Type |
Name |
Description |
| int |
id |
|
| string |
name |
|
| int |
userId |
|
Returns
View Source
Save(IEnumerable<TItem>, int)
Declaration
public void Save(IEnumerable<TItem> items, int userId = -1)
Parameters
| Type |
Name |
Description |
| IEnumerable<TItem> |
items |
|
| int |
userId |
|
View Source
Save(TItem?, int)
Declaration
public void Save(TItem? item, int userId = -1)
Parameters
| Type |
Name |
Description |
| TItem |
item |
|
| int |
userId |
|
View Source
SaveAsync(TItem, Guid)
Declaration
public Task SaveAsync(TItem item, Guid performingUserKey)
Parameters
| Type |
Name |
Description |
| TItem |
item |
|
| Guid |
performingUserKey |
|
Returns
View Source
SaveContainer(EntityContainer, int)
Declaration
[Obsolete("Please use IContentTypeContainerService or IMediaTypeContainerService for all content or media type container operations. Will be removed in V16.")]
public Attempt<OperationResult?> SaveContainer(EntityContainer container, int userId = -1)
Parameters
Returns
View Source
UpdateAsync(TItem, Guid)
Declaration
public Task<Attempt<ContentTypeOperationStatus>> UpdateAsync(TItem item, Guid performingUserKey)
Parameters
| Type |
Name |
Description |
| TItem |
item |
|
| Guid |
performingUserKey |
|
Returns
View Source
ValidateComposition(TItem?)
Declaration
public Attempt<string[]?> ValidateComposition(TItem? compo)
Parameters
| Type |
Name |
Description |
| TItem |
compo |
|
Returns
View Source
ValidateLocked(TItem)
Declaration
protected void ValidateLocked(TItem compositionContentType)
Parameters
| Type |
Name |
Description |
| TItem |
compositionContentType |
|