Class MemberTypeService
Provides services for managing member types in Umbraco.
Inheritance
Namespace: Umbraco.Cms.Core.Services
Assembly: Umbraco.Core.dll
Syntax
public class MemberTypeService : ContentTypeServiceBase<IMemberTypeRepository, IMemberType>, IMemberTypeService, IContentTypeBaseService<IMemberType>, IContentTypeBaseService, IService
Remarks
This service handles operations for member types, which define the structure and properties available for members in the system. It extends the base content type service functionality with member-specific behavior.
Constructors
View SourceMemberTypeService(ICoreScopeProvider, ILoggerFactory, IEventMessagesFactory, IMemberService, IMemberTypeRepository, IAuditRepository, IMemberTypeContainerRepository, IEntityRepository, IEventAggregator, IUserIdKeyResolver, ContentTypeFilterCollection)
Initializes a new instance of the MemberTypeService class.
Declaration
[Obsolete("Use the non-obsolete constructor instead. Scheduled for removal in Umbraco 19.")]
public MemberTypeService(ICoreScopeProvider provider, ILoggerFactory loggerFactory, IEventMessagesFactory eventMessagesFactory, IMemberService memberService, IMemberTypeRepository memberTypeRepository, IAuditRepository auditRepository, IMemberTypeContainerRepository entityContainerRepository, IEntityRepository entityRepository, IEventAggregator eventAggregator, IUserIdKeyResolver userIdKeyResolver, ContentTypeFilterCollection contentTypeFilters)
Parameters
| Type | Name | Description |
|---|---|---|
| ICoreScopeProvider | provider | The core scope provider for managing database transactions. |
| ILoggerFactory | loggerFactory | The factory for creating loggers. |
| IEventMessagesFactory | eventMessagesFactory | The factory for creating event messages. |
| IMemberService | memberService | The member service for member-related operations. |
| IMemberTypeRepository | memberTypeRepository | The repository for member type operations. |
| IAuditRepository | auditRepository | The repository for audit logging (obsolete). |
| IMemberTypeContainerRepository | entityContainerRepository | The repository for member type container operations. |
| IEntityRepository | entityRepository | The repository for entity operations. |
| IEventAggregator | eventAggregator | The event aggregator for publishing notifications. |
| IUserIdKeyResolver | userIdKeyResolver | The resolver for converting user keys to IDs. |
| ContentTypeFilterCollection | contentTypeFilters | The collection of content type filters. |
MemberTypeService(ICoreScopeProvider, ILoggerFactory, IEventMessagesFactory, IMemberService, IMemberTypeRepository, IAuditService, IAuditRepository, IMemberTypeContainerRepository, IEntityRepository, IEventAggregator, IUserIdKeyResolver, ContentTypeFilterCollection)
Initializes a new instance of the MemberTypeService class.
Declaration
[Obsolete("Use the non-obsolete constructor instead. Scheduled for removal in Umbraco 19.")]
public MemberTypeService(ICoreScopeProvider provider, ILoggerFactory loggerFactory, IEventMessagesFactory eventMessagesFactory, IMemberService memberService, IMemberTypeRepository memberTypeRepository, IAuditService auditService, IAuditRepository auditRepository, IMemberTypeContainerRepository entityContainerRepository, IEntityRepository entityRepository, IEventAggregator eventAggregator, IUserIdKeyResolver userIdKeyResolver, ContentTypeFilterCollection contentTypeFilters)
Parameters
| Type | Name | Description |
|---|---|---|
| ICoreScopeProvider | provider | The core scope provider for managing database transactions. |
| ILoggerFactory | loggerFactory | The factory for creating loggers. |
| IEventMessagesFactory | eventMessagesFactory | The factory for creating event messages. |
| IMemberService | memberService | The member service for member-related operations. |
| IMemberTypeRepository | memberTypeRepository | The repository for member type operations. |
| IAuditService | auditService | The service for audit logging. |
| IAuditRepository | auditRepository | The repository for audit logging (obsolete). |
| IMemberTypeContainerRepository | entityContainerRepository | The repository for member type container operations. |
| IEntityRepository | entityRepository | The repository for entity operations. |
| IEventAggregator | eventAggregator | The event aggregator for publishing notifications. |
| IUserIdKeyResolver | userIdKeyResolver | The resolver for converting user keys to IDs. |
| ContentTypeFilterCollection | contentTypeFilters | The collection of content type filters. |
MemberTypeService(ICoreScopeProvider, ILoggerFactory, IEventMessagesFactory, IMemberService, IMemberTypeRepository, IAuditService, IMemberTypeContainerRepository, IEntityRepository, IEventAggregator, IUserIdKeyResolver, ContentTypeFilterCollection)
Initializes a new instance of the MemberTypeService class.
Declaration
public MemberTypeService(ICoreScopeProvider provider, ILoggerFactory loggerFactory, IEventMessagesFactory eventMessagesFactory, IMemberService memberService, IMemberTypeRepository memberTypeRepository, IAuditService auditService, IMemberTypeContainerRepository entityContainerRepository, IEntityRepository entityRepository, IEventAggregator eventAggregator, IUserIdKeyResolver userIdKeyResolver, ContentTypeFilterCollection contentTypeFilters)
Parameters
| Type | Name | Description |
|---|---|---|
| ICoreScopeProvider | provider | The core scope provider for managing database transactions. |
| ILoggerFactory | loggerFactory | The factory for creating loggers. |
| IEventMessagesFactory | eventMessagesFactory | The factory for creating event messages. |
| IMemberService | memberService | The member service for member-related operations. |
| IMemberTypeRepository | memberTypeRepository | The repository for member type operations. |
| IAuditService | auditService | The service for audit logging. |
| IMemberTypeContainerRepository | entityContainerRepository | The repository for member type container operations. |
| IEntityRepository | entityRepository | The repository for entity operations. |
| IEventAggregator | eventAggregator | The event aggregator for publishing notifications. |
| IUserIdKeyResolver | userIdKeyResolver | The resolver for converting user keys to 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 SourceDeleteItemsOfTypes(IEnumerable<int>)
Deletes all members that use the specified member type IDs.
Declaration
protected override void DeleteItemsOfTypes(IEnumerable<int> typeIds)
Parameters
| Type | Name | Description |
|---|---|---|
| IEnumerable<int> | typeIds | The IDs of the member types whose members should be deleted. |
GetContentTypeChangedNotification(IEnumerable<ContentTypeChange<IMemberType>>, EventMessages)
Gets a content type changed notification.
Declaration
protected override ContentTypeChangeNotification<IMemberType> GetContentTypeChangedNotification(IEnumerable<ContentTypeChange<IMemberType>> changes, EventMessages eventMessages)
Parameters
| Type | Name | Description |
|---|---|---|
| IEnumerable<ContentTypeChange<IMemberType>> | changes | The collection of content type changes. |
| EventMessages | eventMessages | The event messages. |
Returns
| Type | Description |
|---|---|
| ContentTypeChangeNotification<IMemberType> | The content type changed notification. |
GetContentTypeRefreshedNotification(IEnumerable<ContentTypeChange<IMemberType>>, EventMessages)
Gets a content type refreshed notification that is published within the transaction.
Declaration
protected override ContentTypeRefreshNotification<IMemberType> GetContentTypeRefreshedNotification(IEnumerable<ContentTypeChange<IMemberType>> changes, EventMessages eventMessages)
Parameters
| Type | Name | Description |
|---|---|---|
| IEnumerable<ContentTypeChange<IMemberType>> | changes | The collection of content type changes. |
| EventMessages | eventMessages | The event messages. |
Returns
| Type | Description |
|---|---|
| ContentTypeRefreshNotification<IMemberType> | 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.
GetDefault()
Gets the alias of the default member type.
Declaration
public string GetDefault()
Returns
| Type | Description |
|---|---|
| string | The alias of the member type named "Member" if it exists; otherwise, the alias of the first available member type. |
Exceptions
| Type | Condition |
|---|---|
| InvalidOperationException | Thrown when no member types are available in the system. |
GetDeletedNotification(IEnumerable<IMemberType>, EventMessages)
Gets a deleted notification for multiple content type items.
Declaration
protected override DeletedNotification<IMemberType> GetDeletedNotification(IEnumerable<IMemberType> items, EventMessages eventMessages)
Parameters
| Type | Name | Description |
|---|---|---|
| IEnumerable<IMemberType> | items | The content type items that were deleted. |
| EventMessages | eventMessages | The event messages. |
Returns
| Type | Description |
|---|---|
| DeletedNotification<IMemberType> | The deleted notification. |
GetDeletingNotification(IEnumerable<IMemberType>, EventMessages)
Gets a deleting notification for multiple content type items.
Declaration
protected override DeletingNotification<IMemberType> GetDeletingNotification(IEnumerable<IMemberType> items, EventMessages eventMessages)
Parameters
| Type | Name | Description |
|---|---|---|
| IEnumerable<IMemberType> | items | The content type items being deleted. |
| EventMessages | eventMessages | The event messages. |
Returns
| Type | Description |
|---|---|
| DeletingNotification<IMemberType> | The deleting notification. |
GetDeletingNotification(IMemberType, EventMessages)
Gets a deleting notification for a single content type item.
Declaration
protected override DeletingNotification<IMemberType> GetDeletingNotification(IMemberType item, EventMessages eventMessages)
Parameters
| Type | Name | Description |
|---|---|---|
| IMemberType | item | The content type item being deleted. |
| EventMessages | eventMessages | The event messages. |
Returns
| Type | Description |
|---|---|
| DeletingNotification<IMemberType> | The deleting notification. |
GetMovedNotification(IEnumerable<MoveEventInfo<IMemberType>>, EventMessages)
Gets a moved notification for multiple content type items.
Declaration
protected override MovedNotification<IMemberType> GetMovedNotification(IEnumerable<MoveEventInfo<IMemberType>> moveInfo, EventMessages eventMessages)
Parameters
| Type | Name | Description |
|---|---|---|
| IEnumerable<MoveEventInfo<IMemberType>> | moveInfo | The collection of move event information. |
| EventMessages | eventMessages | The event messages. |
Returns
| Type | Description |
|---|---|
| MovedNotification<IMemberType> | The moved notification. |
GetMovingNotification(MoveEventInfo<IMemberType>, EventMessages)
Gets a moving notification for a content type item.
Declaration
protected override MovingNotification<IMemberType> GetMovingNotification(MoveEventInfo<IMemberType> moveInfo, EventMessages eventMessages)
Parameters
| Type | Name | Description |
|---|---|---|
| MoveEventInfo<IMemberType> | moveInfo | The move event information. |
| EventMessages | eventMessages | The event messages. |
Returns
| Type | Description |
|---|---|
| MovingNotification<IMemberType> | The moving notification. |
GetSavedNotification(IEnumerable<IMemberType>, EventMessages)
Gets a saved notification for multiple content type items.
Declaration
protected override SavedNotification<IMemberType> GetSavedNotification(IEnumerable<IMemberType> items, EventMessages eventMessages)
Parameters
| Type | Name | Description |
|---|---|---|
| IEnumerable<IMemberType> | items | The content type items that were saved. |
| EventMessages | eventMessages | The event messages. |
Returns
| Type | Description |
|---|---|
| SavedNotification<IMemberType> | The saved notification. |
GetSavedNotification(IMemberType, EventMessages)
Gets a saved notification for a single content type item.
Declaration
protected override SavedNotification<IMemberType> GetSavedNotification(IMemberType item, EventMessages eventMessages)
Parameters
| Type | Name | Description |
|---|---|---|
| IMemberType | item | The content type item that was saved. |
| EventMessages | eventMessages | The event messages. |
Returns
| Type | Description |
|---|---|
| SavedNotification<IMemberType> | The saved notification. |
GetSavingNotification(IEnumerable<IMemberType>, EventMessages)
Gets a saving notification for multiple content type items.
Declaration
protected override SavingNotification<IMemberType> GetSavingNotification(IEnumerable<IMemberType> items, EventMessages eventMessages)
Parameters
| Type | Name | Description |
|---|---|---|
| IEnumerable<IMemberType> | items | The content type items being saved. |
| EventMessages | eventMessages | The event messages. |
Returns
| Type | Description |
|---|---|
| SavingNotification<IMemberType> | The saving notification. |
GetSavingNotification(IMemberType, EventMessages)
Gets a saving notification for a single content type item.
Declaration
protected override SavingNotification<IMemberType> GetSavingNotification(IMemberType item, EventMessages eventMessages)
Parameters
| Type | Name | Description |
|---|---|---|
| IMemberType | item | The content type item being saved. |
| EventMessages | eventMessages | The event messages. |
Returns
| Type | Description |
|---|---|
| SavingNotification<IMemberType> | The saving notification. |
PerformGetAllowedParentKeysAsync(Guid)
Retrieves a collection of allowed parent keys for the specified key.
Declaration
protected override Task<IEnumerable<Guid>> PerformGetAllowedParentKeysAsync(Guid key)
Parameters
| Type | Name | Description |
|---|---|---|
| Guid | key | The unique identifier of the key for which to retrieve allowed parent keys. |
Returns
| Type | Description |
|---|---|
| Task<IEnumerable<Guid>> |
Remarks
Unlike document and media types, allowed children (and therefore parents) are not defined for member types.