Class MediaTypeService
Represents the Media Type Service, which provides operations for managing IMediaType entities.
Inheritance
Namespace: Umbraco.Cms.Core.Services
Assembly: Umbraco.Core.dll
Syntax
public class MediaTypeService : ContentTypeServiceBase<IMediaTypeRepository, IMediaType>, IMediaTypeService, IContentTypeBaseService<IMediaType>, IContentTypeBaseService, IService
Constructors
View SourceMediaTypeService(ICoreScopeProvider, ILoggerFactory, IEventMessagesFactory, IMediaService, IMediaTypeRepository, IAuditRepository, IMediaTypeContainerRepository, IEntityRepository, IEventAggregator, IUserIdKeyResolver, ContentTypeFilterCollection)
Initializes a new instance of the MediaTypeService class.
Declaration
[Obsolete("Use the non-obsolete constructor instead. Scheduled for removal in Umbraco 19.")]
public MediaTypeService(ICoreScopeProvider provider, ILoggerFactory loggerFactory, IEventMessagesFactory eventMessagesFactory, IMediaService mediaService, IMediaTypeRepository mediaTypeRepository, IAuditRepository auditRepository, IMediaTypeContainerRepository entityContainerRepository, IEntityRepository entityRepository, IEventAggregator eventAggregator, IUserIdKeyResolver userIdKeyResolver, ContentTypeFilterCollection contentTypeFilters)
Parameters
| Type | Name | Description |
|---|---|---|
| ICoreScopeProvider | provider | The ICoreScopeProvider for database scope management. |
| ILoggerFactory | loggerFactory | The Microsoft.Extensions.Logging.ILoggerFactory for creating loggers. |
| IEventMessagesFactory | eventMessagesFactory | The IEventMessagesFactory for creating event messages. |
| IMediaService | mediaService | The IMediaService for media operations. |
| IMediaTypeRepository | mediaTypeRepository | The IMediaTypeRepository for media type persistence. |
| IAuditRepository | auditRepository | The audit repository (obsolete, not used). |
| IMediaTypeContainerRepository | entityContainerRepository | The IMediaTypeContainerRepository for media type container operations. |
| IEntityRepository | entityRepository | The IEntityRepository for entity operations. |
| IEventAggregator | eventAggregator | The IEventAggregator for publishing events. |
| IUserIdKeyResolver | userIdKeyResolver | The IUserIdKeyResolver for resolving user IDs. |
| ContentTypeFilterCollection | contentTypeFilters | The collection of content type filters. |
MediaTypeService(ICoreScopeProvider, ILoggerFactory, IEventMessagesFactory, IMediaService, IMediaTypeRepository, IAuditService, IAuditRepository, IMediaTypeContainerRepository, IEntityRepository, IEventAggregator, IUserIdKeyResolver, ContentTypeFilterCollection)
Initializes a new instance of the MediaTypeService class.
Declaration
[Obsolete("Use the non-obsolete constructor instead. Scheduled for removal in Umbraco 19.")]
public MediaTypeService(ICoreScopeProvider provider, ILoggerFactory loggerFactory, IEventMessagesFactory eventMessagesFactory, IMediaService mediaService, IMediaTypeRepository mediaTypeRepository, IAuditService auditService, IAuditRepository auditRepository, IMediaTypeContainerRepository entityContainerRepository, IEntityRepository entityRepository, IEventAggregator eventAggregator, IUserIdKeyResolver userIdKeyResolver, ContentTypeFilterCollection contentTypeFilters)
Parameters
| Type | Name | Description |
|---|---|---|
| ICoreScopeProvider | provider | The ICoreScopeProvider for database scope management. |
| ILoggerFactory | loggerFactory | The Microsoft.Extensions.Logging.ILoggerFactory for creating loggers. |
| IEventMessagesFactory | eventMessagesFactory | The IEventMessagesFactory for creating event messages. |
| IMediaService | mediaService | The IMediaService for media operations. |
| IMediaTypeRepository | mediaTypeRepository | The IMediaTypeRepository for media type persistence. |
| IAuditService | auditService | The IAuditService for audit logging. |
| IAuditRepository | auditRepository | The audit repository (obsolete, not used). |
| IMediaTypeContainerRepository | entityContainerRepository | The IMediaTypeContainerRepository for media type container operations. |
| IEntityRepository | entityRepository | The IEntityRepository for entity operations. |
| IEventAggregator | eventAggregator | The IEventAggregator for publishing events. |
| IUserIdKeyResolver | userIdKeyResolver | The IUserIdKeyResolver for resolving user IDs. |
| ContentTypeFilterCollection | contentTypeFilters | The collection of content type filters. |
MediaTypeService(ICoreScopeProvider, ILoggerFactory, IEventMessagesFactory, IMediaService, IMediaTypeRepository, IAuditService, IMediaTypeContainerRepository, IEntityRepository, IEventAggregator, IUserIdKeyResolver, ContentTypeFilterCollection)
Initializes a new instance of the MediaTypeService class.
Declaration
public MediaTypeService(ICoreScopeProvider provider, ILoggerFactory loggerFactory, IEventMessagesFactory eventMessagesFactory, IMediaService mediaService, IMediaTypeRepository mediaTypeRepository, IAuditService auditService, IMediaTypeContainerRepository entityContainerRepository, IEntityRepository entityRepository, IEventAggregator eventAggregator, IUserIdKeyResolver userIdKeyResolver, ContentTypeFilterCollection contentTypeFilters)
Parameters
| Type | Name | Description |
|---|---|---|
| ICoreScopeProvider | provider | The ICoreScopeProvider for database scope management. |
| ILoggerFactory | loggerFactory | The Microsoft.Extensions.Logging.ILoggerFactory for creating loggers. |
| IEventMessagesFactory | eventMessagesFactory | The IEventMessagesFactory for creating event messages. |
| IMediaService | mediaService | The IMediaService for media operations. |
| IMediaTypeRepository | mediaTypeRepository | The IMediaTypeRepository for media type persistence. |
| IAuditService | auditService | The IAuditService for audit logging. |
| IMediaTypeContainerRepository | entityContainerRepository | The IMediaTypeContainerRepository for media type container operations. |
| IEntityRepository | entityRepository | The IEntityRepository for entity operations. |
| IEventAggregator | eventAggregator | The IEventAggregator for publishing events. |
| IUserIdKeyResolver | userIdKeyResolver | The IUserIdKeyResolver for resolving user IDs. |
| ContentTypeFilterCollection | contentTypeFilters | The collection of content type filters. |
Properties
View SourceContainedObjectType
Gets the object type GUID for content types contained by this service.
Declaration
protected override Guid ContainedObjectType { get; }
Property Value
| Type | Description |
|---|---|
| Guid |
ReadLockIds
Gets the read lock IDs for this content type.
Declaration
protected override int[] ReadLockIds { get; }
Property Value
| Type | Description |
|---|---|
| int[] |
WriteLockIds
Gets the write lock IDs for this content type.
Declaration
protected override int[] WriteLockIds { get; }
Property Value
| Type | Description |
|---|---|
| int[] |
Methods
View SourceCanDelete(IMediaType)
Determines whether the specified content type can be deleted.
Declaration
protected override bool CanDelete(IMediaType item)
Parameters
| Type | Name | Description |
|---|---|---|
| IMediaType | item | The content type to check. |
Returns
| Type | Description |
|---|---|
| bool |
|
DeleteItemsOfTypes(IEnumerable<int>)
Deletes content items of the specified types.
Declaration
protected override void DeleteItemsOfTypes(IEnumerable<int> typeIds)
Parameters
| Type | Name | Description |
|---|---|---|
| IEnumerable<int> | typeIds | The type IDs whose content should be deleted. |
GetContentTypeChangedNotification(IEnumerable<ContentTypeChange<IMediaType>>, EventMessages)
Gets a content type changed notification.
Declaration
protected override ContentTypeChangeNotification<IMediaType> GetContentTypeChangedNotification(IEnumerable<ContentTypeChange<IMediaType>> changes, EventMessages eventMessages)
Parameters
| Type | Name | Description |
|---|---|---|
| IEnumerable<ContentTypeChange<IMediaType>> | changes | The collection of content type changes. |
| EventMessages | eventMessages | The event messages. |
Returns
| Type | Description |
|---|---|
| ContentTypeChangeNotification<IMediaType> | The content type changed notification. |
GetContentTypeRefreshedNotification(IEnumerable<ContentTypeChange<IMediaType>>, EventMessages)
Gets a content type refreshed notification that is published within the transaction.
Declaration
protected override ContentTypeRefreshNotification<IMediaType> GetContentTypeRefreshedNotification(IEnumerable<ContentTypeChange<IMediaType>> changes, EventMessages eventMessages)
Parameters
| Type | Name | Description |
|---|---|---|
| IEnumerable<ContentTypeChange<IMediaType>> | changes | The collection of content type changes. |
| EventMessages | eventMessages | The event messages. |
Returns
| Type | Description |
|---|---|
| ContentTypeRefreshNotification<IMediaType> | The content type refreshed notification. |
Remarks
This notification is identical to GetContentTypeChangedNotification, however it needs to be a different notification type because it's published within the transaction. The purpose of this notification being published within the transaction is so that listeners can perform database operations from within the same transaction and guarantee data consistency so that if anything goes wrong the entire transaction can be rolled back. This is used by Nucache.
GetDeletedNotification(IEnumerable<IMediaType>, EventMessages)
Gets a deleted notification for multiple content type items.
Declaration
protected override DeletedNotification<IMediaType> GetDeletedNotification(IEnumerable<IMediaType> items, EventMessages eventMessages)
Parameters
| Type | Name | Description |
|---|---|---|
| IEnumerable<IMediaType> | items | The content type items that were deleted. |
| EventMessages | eventMessages | The event messages. |
Returns
| Type | Description |
|---|---|
| DeletedNotification<IMediaType> | The deleted notification. |
GetDeletingNotification(IEnumerable<IMediaType>, EventMessages)
Gets a deleting notification for multiple content type items.
Declaration
protected override DeletingNotification<IMediaType> GetDeletingNotification(IEnumerable<IMediaType> items, EventMessages eventMessages)
Parameters
| Type | Name | Description |
|---|---|---|
| IEnumerable<IMediaType> | items | The content type items being deleted. |
| EventMessages | eventMessages | The event messages. |
Returns
| Type | Description |
|---|---|
| DeletingNotification<IMediaType> | The deleting notification. |
GetDeletingNotification(IMediaType, EventMessages)
Gets a deleting notification for a single content type item.
Declaration
protected override DeletingNotification<IMediaType> GetDeletingNotification(IMediaType item, EventMessages eventMessages)
Parameters
| Type | Name | Description |
|---|---|---|
| IMediaType | item | The content type item being deleted. |
| EventMessages | eventMessages | The event messages. |
Returns
| Type | Description |
|---|---|
| DeletingNotification<IMediaType> | The deleting notification. |
GetMovedNotification(IEnumerable<MoveEventInfo<IMediaType>>, EventMessages)
Gets a moved notification for multiple content type items.
Declaration
protected override MovedNotification<IMediaType> GetMovedNotification(IEnumerable<MoveEventInfo<IMediaType>> moveInfo, EventMessages eventMessages)
Parameters
| Type | Name | Description |
|---|---|---|
| IEnumerable<MoveEventInfo<IMediaType>> | moveInfo | The collection of move event information. |
| EventMessages | eventMessages | The event messages. |
Returns
| Type | Description |
|---|---|
| MovedNotification<IMediaType> | The moved notification. |
GetMovingNotification(MoveEventInfo<IMediaType>, EventMessages)
Gets a moving notification for a content type item.
Declaration
protected override MovingNotification<IMediaType> GetMovingNotification(MoveEventInfo<IMediaType> moveInfo, EventMessages eventMessages)
Parameters
| Type | Name | Description |
|---|---|---|
| MoveEventInfo<IMediaType> | moveInfo | The move event information. |
| EventMessages | eventMessages | The event messages. |
Returns
| Type | Description |
|---|---|
| MovingNotification<IMediaType> | The moving notification. |
GetSavedNotification(IEnumerable<IMediaType>, EventMessages)
Gets a saved notification for multiple content type items.
Declaration
protected override SavedNotification<IMediaType> GetSavedNotification(IEnumerable<IMediaType> items, EventMessages eventMessages)
Parameters
| Type | Name | Description |
|---|---|---|
| IEnumerable<IMediaType> | items | The content type items that were saved. |
| EventMessages | eventMessages | The event messages. |
Returns
| Type | Description |
|---|---|
| SavedNotification<IMediaType> | The saved notification. |
GetSavedNotification(IMediaType, EventMessages)
Gets a saved notification for a single content type item.
Declaration
protected override SavedNotification<IMediaType> GetSavedNotification(IMediaType item, EventMessages eventMessages)
Parameters
| Type | Name | Description |
|---|---|---|
| IMediaType | item | The content type item that was saved. |
| EventMessages | eventMessages | The event messages. |
Returns
| Type | Description |
|---|---|
| SavedNotification<IMediaType> | The saved notification. |
GetSavingNotification(IEnumerable<IMediaType>, EventMessages)
Gets a saving notification for multiple content type items.
Declaration
protected override SavingNotification<IMediaType> GetSavingNotification(IEnumerable<IMediaType> items, EventMessages eventMessages)
Parameters
| Type | Name | Description |
|---|---|---|
| IEnumerable<IMediaType> | items | The content type items being saved. |
| EventMessages | eventMessages | The event messages. |
Returns
| Type | Description |
|---|---|
| SavingNotification<IMediaType> | The saving notification. |
GetSavingNotification(IMediaType, EventMessages)
Gets a saving notification for a single content type item.
Declaration
protected override SavingNotification<IMediaType> GetSavingNotification(IMediaType item, EventMessages eventMessages)
Parameters
| Type | Name | Description |
|---|---|---|
| IMediaType | item | The content type item being saved. |
| EventMessages | eventMessages | The event messages. |
Returns
| Type | Description |
|---|---|
| SavingNotification<IMediaType> | The saving notification. |