Search Results for

    Show / Hide Table of Contents
    View Source

    Class MemberService

    Represents the MemberService.

    Inheritance
    object
    RepositoryService
    Namespace: Umbraco.Cms.Core.Services
    Assembly: Umbraco.Core.dll
    Syntax
    public class MemberService : RepositoryService, IMemberService, IMembershipMemberService, IMembershipMemberService<IMember>, IMembershipRoleService<IMember>, IContentServiceBase<IMember>, IContentServiceBase, IService

    Constructors

    View Source

    MemberService(ICoreScopeProvider, ILoggerFactory, IEventMessagesFactory, IMemberGroupService, IMemberRepository, IMemberTypeRepository, IMemberGroupRepository, IAuditRepository, Lazy<IIdKeyMap>)

    Declaration
    [Obsolete("Use the non-obsolete constructor instead. Scheduled removal in v19.")]
    public MemberService(ICoreScopeProvider provider, ILoggerFactory loggerFactory, IEventMessagesFactory eventMessagesFactory, IMemberGroupService memberGroupService, IMemberRepository memberRepository, IMemberTypeRepository memberTypeRepository, IMemberGroupRepository memberGroupRepository, IAuditRepository auditRepository, Lazy<IIdKeyMap> idKeyMap)
    Parameters
    Type Name Description
    ICoreScopeProvider provider
    ILoggerFactory loggerFactory
    IEventMessagesFactory eventMessagesFactory
    IMemberGroupService memberGroupService
    IMemberRepository memberRepository
    IMemberTypeRepository memberTypeRepository
    IMemberGroupRepository memberGroupRepository
    IAuditRepository auditRepository
    Lazy<IIdKeyMap> idKeyMap
    View Source

    MemberService(ICoreScopeProvider, ILoggerFactory, IEventMessagesFactory, IMemberGroupService, IMemberRepository, IMemberTypeRepository, IMemberGroupRepository, IAuditService, Lazy<IIdKeyMap>, IUserIdKeyResolver)

    Declaration
    public MemberService(ICoreScopeProvider provider, ILoggerFactory loggerFactory, IEventMessagesFactory eventMessagesFactory, IMemberGroupService memberGroupService, IMemberRepository memberRepository, IMemberTypeRepository memberTypeRepository, IMemberGroupRepository memberGroupRepository, IAuditService auditService, Lazy<IIdKeyMap> idKeyMap, IUserIdKeyResolver userIdKeyResolver)
    Parameters
    Type Name Description
    ICoreScopeProvider provider
    ILoggerFactory loggerFactory
    IEventMessagesFactory eventMessagesFactory
    IMemberGroupService memberGroupService
    IMemberRepository memberRepository
    IMemberTypeRepository memberTypeRepository
    IMemberGroupRepository memberGroupRepository
    IAuditService auditService
    Lazy<IIdKeyMap> idKeyMap
    IUserIdKeyResolver userIdKeyResolver
    View Source

    MemberService(ICoreScopeProvider, ILoggerFactory, IEventMessagesFactory, IMemberGroupService, IMemberRepository, IMemberTypeRepository, IMemberGroupRepository, IAuditService, IAuditRepository, Lazy<IIdKeyMap>, IUserIdKeyResolver)

    Declaration
    [Obsolete("Use the non-obsolete constructor instead. Scheduled removal in v19.")]
    public MemberService(ICoreScopeProvider provider, ILoggerFactory loggerFactory, IEventMessagesFactory eventMessagesFactory, IMemberGroupService memberGroupService, IMemberRepository memberRepository, IMemberTypeRepository memberTypeRepository, IMemberGroupRepository memberGroupRepository, IAuditService auditService, IAuditRepository auditRepository, Lazy<IIdKeyMap> idKeyMap, IUserIdKeyResolver userIdKeyResolver)
    Parameters
    Type Name Description
    ICoreScopeProvider provider
    ILoggerFactory loggerFactory
    IEventMessagesFactory eventMessagesFactory
    IMemberGroupService memberGroupService
    IMemberRepository memberRepository
    IMemberTypeRepository memberTypeRepository
    IMemberGroupRepository memberGroupRepository
    IAuditService auditService
    IAuditRepository auditRepository
    Lazy<IIdKeyMap> idKeyMap
    IUserIdKeyResolver userIdKeyResolver

    Methods

    View Source

    AddRole(string)

    Declaration
    public void AddRole(string roleName)
    Parameters
    Type Name Description
    string roleName
    View Source

    AssignRole(int, string)

    Declaration
    public void AssignRole(int memberId, string roleName)
    Parameters
    Type Name Description
    int memberId
    string roleName
    View Source

    AssignRole(string, string)

    Declaration
    public void AssignRole(string username, string roleName)
    Parameters
    Type Name Description
    string username
    string roleName
    View Source

    AssignRoles(int[], string[])

    Declaration
    public void AssignRoles(int[] memberIds, string[] roleNames)
    Parameters
    Type Name Description
    int[] memberIds
    string[] roleNames
    View Source

    AssignRoles(string[], string[])

    Declaration
    public void AssignRoles(string[] usernames, string[] roleNames)
    Parameters
    Type Name Description
    string[] usernames
    string[] roleNames
    View Source

    CheckDataIntegrity(ContentDataIntegrityReportOptions)

    Checks/fixes the data integrity of node paths/levels stored in the database

    Declaration
    public ContentDataIntegrityReport CheckDataIntegrity(ContentDataIntegrityReportOptions options)
    Parameters
    Type Name Description
    ContentDataIntegrityReportOptions options
    Returns
    Type Description
    ContentDataIntegrityReport
    View Source

    Count(string?)

    Gets the count of Members by an optional MemberType alias

    Declaration
    public int Count(string? memberTypeAlias = null)
    Parameters
    Type Name Description
    string memberTypeAlias

    Optional alias for the MemberType when counting number of Members

    Returns
    Type Description
    int

    int with number of Members

    Remarks

    If no alias is supplied then the count for all Member will be returned

    View Source

    CreateMember(string, string, string, string)

    Creates an IMember object without persisting it

    Declaration
    public IMember CreateMember(string username, string email, string name, string memberTypeAlias)
    Parameters
    Type Name Description
    string username

    Username of the Member to create

    string email

    Email of the Member to create

    string name

    Name of the Member to create

    string memberTypeAlias

    Alias of the MemberType the Member should be based on

    Returns
    Type Description
    IMember

    IMember

    Remarks

    This method is convenient for when you need to add properties to a new Member before persisting it in order to limit the amount of times its saved. Also note that the returned IMember will not have an Id until its saved.

    Exceptions
    Type Condition
    ArgumentException

    Thrown when a member type for the given alias isn't found

    View Source

    CreateMember(string, string, string, IMemberType)

    Creates an IMember object without persisting it

    Declaration
    public IMember CreateMember(string username, string email, string name, IMemberType memberType)
    Parameters
    Type Name Description
    string username

    Username of the Member to create

    string email

    Email of the Member to create

    string name

    Name of the Member to create

    IMemberType memberType

    MemberType the Member should be based on

    Returns
    Type Description
    IMember

    IMember

    Remarks

    This method is convenient for when you need to add properties to a new Member before persisting it in order to limit the amount of times its saved. Also note that the returned IMember will not have an Id until its saved.

    View Source

    CreateMemberWithIdentity(string, string, string)

    Creates and persists a Member

    Declaration
    public IMember CreateMemberWithIdentity(string username, string email, string memberTypeAlias)
    Parameters
    Type Name Description
    string username

    Username of the Member to create

    string email

    Email of the Member to create

    string memberTypeAlias

    Alias of the MemberType the Member should be based on

    Returns
    Type Description
    IMember

    IMember

    Remarks

    Using this method will persist the Member object before its returned meaning that it will have an Id available (unlike the CreateMember method)

    View Source

    CreateMemberWithIdentity(string, string, string, bool)

    Creates and persists a Member

    Declaration
    public IMember CreateMemberWithIdentity(string username, string email, string memberTypeAlias, bool isApproved)
    Parameters
    Type Name Description
    string username

    Username of the Member to create

    string email

    Email of the Member to create

    string memberTypeAlias

    Alias of the MemberType the Member should be based on

    bool isApproved

    Whether the member is approved or not

    Returns
    Type Description
    IMember

    IMember

    Remarks

    Using this method will persist the Member object before its returned meaning that it will have an Id available (unlike the CreateMember method)

    View Source

    CreateMemberWithIdentity(string, string, string, string)

    Creates and persists a Member

    Declaration
    public IMember CreateMemberWithIdentity(string username, string email, string name, string memberTypeAlias)
    Parameters
    Type Name Description
    string username

    Username of the Member to create

    string email

    Email of the Member to create

    string name

    Name of the Member to create

    string memberTypeAlias

    Alias of the MemberType the Member should be based on

    Returns
    Type Description
    IMember

    IMember

    Remarks

    Using this method will persist the Member object before its returned meaning that it will have an Id available (unlike the CreateMember method)

    View Source

    CreateMemberWithIdentity(string, string, string, string, bool)

    Creates and persists a Member

    Declaration
    public IMember CreateMemberWithIdentity(string username, string email, string name, string memberTypeAlias, bool isApproved)
    Parameters
    Type Name Description
    string username

    Username of the Member to create

    string email

    Email of the Member to create

    string name

    Name of the Member to create

    string memberTypeAlias

    Alias of the MemberType the Member should be based on

    bool isApproved

    Whether the member is approved or not

    Returns
    Type Description
    IMember

    IMember

    Remarks

    Using this method will persist the Member object before its returned meaning that it will have an Id available (unlike the CreateMember method)

    View Source

    CreateMemberWithIdentity(string, string, string, string, string, bool)

    Creates and persists a Member.

    Declaration
    public IMember CreateMemberWithIdentity(string username, string email, string name, string passwordValue, string memberTypeAlias, bool isApproved = true)
    Parameters
    Type Name Description
    string username

    Username of the Member to create.

    string email

    Email of the Member to create.

    string name

    Name of the Member to create.

    string passwordValue

    Password value of the Member to create.

    string memberTypeAlias

    Alias of the MemberType the Member should be based on.

    bool isApproved

    Optional IsApproved of the Member to create.

    Returns
    Type Description
    IMember

    IMember

    Remarks

    Using this method will persist the Member object before its returned meaning that it will have an Id available (unlike the CreateMember(string, string, string, string) method).

    View Source

    CreateMemberWithIdentity(string, string, string, IMemberType)

    Creates and persists a Member

    Declaration
    public IMember CreateMemberWithIdentity(string username, string email, string name, IMemberType memberType)
    Parameters
    Type Name Description
    string username

    Username of the Member to create

    string email

    Email of the Member to create

    string name

    Name of the Member to create

    IMemberType memberType

    MemberType the Member should be based on

    Returns
    Type Description
    IMember

    IMember

    Remarks

    Using this method will persist the Member object before its returned meaning that it will have an Id available (unlike the CreateMember method)

    View Source

    CreateMemberWithIdentity(string, string, string, IMemberType, bool)

    Creates and persists a Member

    Declaration
    public IMember CreateMemberWithIdentity(string username, string email, string name, IMemberType memberType, bool isApproved)
    Parameters
    Type Name Description
    string username

    Username of the Member to create

    string email

    Email of the Member to create

    string name

    Name of the Member to create

    IMemberType memberType

    MemberType the Member should be based on

    bool isApproved

    Is the member approved

    Returns
    Type Description
    IMember

    IMember

    Remarks

    Using this method will persist the Member object before its returned meaning that it will have an Id available (unlike the CreateMember method)

    View Source

    CreateMemberWithIdentity(string, string, IMemberType)

    Creates and persists a new Member

    Declaration
    public IMember CreateMemberWithIdentity(string username, string email, IMemberType memberType)
    Parameters
    Type Name Description
    string username

    Username of the Member to create

    string email

    Email of the Member to create

    IMemberType memberType

    IMemberType which the Member should be based on

    Returns
    Type Description
    IMember

    IMember

    View Source

    CreateMemberWithIdentity(string, string, IMemberType, bool)

    Creates and persists a Member

    Declaration
    public IMember CreateMemberWithIdentity(string username, string email, IMemberType memberType, bool isApproved)
    Parameters
    Type Name Description
    string username

    Username of the Member to create

    string email

    Email of the Member to create

    IMemberType memberType

    MemberType the Member should be based on

    bool isApproved

    Is the member approved.

    Returns
    Type Description
    IMember

    IMember

    Remarks

    Using this method will persist the Member object before its returned meaning that it will have an Id available (unlike the CreateMember method)

    View Source

    Delete(IMember)

    Deletes an IMembershipUser

    Declaration
    public void Delete(IMember member)
    Parameters
    Type Name Description
    IMember member
    Remarks

    An IMembershipUser can be of type IMember or IUser

    View Source

    Delete(IMember, int)

    Permanently deletes an IMember object

    Declaration
    public Attempt<OperationResult?> Delete(IMember member, int userId = -1)
    Parameters
    Type Name Description
    IMember member

    The IMember to delete

    int userId

    Id of the User deleting the Member

    Returns
    Type Description
    Attempt<OperationResult>
    View Source

    DeleteMembersOfType(int)

    Delete Members of the specified MemberType id

    Declaration
    public void DeleteMembersOfType(int memberTypeId)
    Parameters
    Type Name Description
    int memberTypeId

    Id of the MemberType

    View Source

    DeleteRole(string, bool)

    Declaration
    public bool DeleteRole(string roleName, bool throwIfBeingUsed)
    Parameters
    Type Name Description
    string roleName
    bool throwIfBeingUsed
    Returns
    Type Description
    bool
    View Source

    DissociateRole(int, string)

    Declaration
    public void DissociateRole(int memberId, string roleName)
    Parameters
    Type Name Description
    int memberId
    string roleName
    View Source

    DissociateRole(string, string)

    Declaration
    public void DissociateRole(string username, string roleName)
    Parameters
    Type Name Description
    string username
    string roleName
    View Source

    DissociateRoles(int[], string[])

    Declaration
    public void DissociateRoles(int[] memberIds, string[] roleNames)
    Parameters
    Type Name Description
    int[] memberIds
    string[] roleNames
    View Source

    DissociateRoles(string[], string[])

    Declaration
    public void DissociateRoles(string[] usernames, string[] roleNames)
    Parameters
    Type Name Description
    string[] usernames
    string[] roleNames
    View Source

    Exists(int)

    Checks if a Member with the id exists

    Declaration
    public bool Exists(int id)
    Parameters
    Type Name Description
    int id

    Id of the Member

    Returns
    Type Description
    bool

    True if the Member exists otherwise False

    View Source

    Exists(string)

    Checks if a Member with the username exists

    Declaration
    public bool Exists(string username)
    Parameters
    Type Name Description
    string username

    Username to check

    Returns
    Type Description
    bool

    True if the Member exists otherwise False

    View Source

    ExportMember(Guid)

    Exports a member.

    Declaration
    public MemberExportModel? ExportMember(Guid key)
    Parameters
    Type Name Description
    Guid key
    Returns
    Type Description
    MemberExportModel
    Remarks

    This is internal for now and is used to export a member in the member editor, it will raise an event so that auditing logs can be created.

    View Source

    FilterAsync(MemberFilter, string, Direction, int, int)

    Declaration
    public Task<PagedModel<IMember>> FilterAsync(MemberFilter memberFilter, string orderBy = "username", Direction orderDirection = Direction.Ascending, int skip = 0, int take = 100)
    Parameters
    Type Name Description
    MemberFilter memberFilter
    string orderBy
    Direction orderDirection
    int skip
    int take
    Returns
    Type Description
    Task<PagedModel<IMember>>
    View Source

    FindByEmail(string, long, int, out long, StringPropertyMatchType)

    Finds a list of IMember objects by a partial email string

    Declaration
    public IEnumerable<IMember> FindByEmail(string emailStringToMatch, long pageIndex, int pageSize, out long totalRecords, StringPropertyMatchType matchType = StringPropertyMatchType.StartsWith)
    Parameters
    Type Name Description
    string emailStringToMatch

    Partial email string to match

    long pageIndex

    Current page index

    int pageSize

    Size of the page

    long totalRecords

    Total number of records found (out)

    StringPropertyMatchType matchType

    The type of match to make as StringPropertyMatchType. Default is StartsWith

    Returns
    Type Description
    IEnumerable<IMember>

    System.Collections.Generic.IEnumerable<T>

    View Source

    FindByUsername(string, long, int, out long, StringPropertyMatchType)

    Finds a list of IMember objects by a partial username

    Declaration
    public IEnumerable<IMember> FindByUsername(string login, long pageIndex, int pageSize, out long totalRecords, StringPropertyMatchType matchType = StringPropertyMatchType.StartsWith)
    Parameters
    Type Name Description
    string login

    Partial username to match

    long pageIndex

    Current page index

    int pageSize

    Size of the page

    long totalRecords

    Total number of records found (out)

    StringPropertyMatchType matchType

    The type of match to make as StringPropertyMatchType. Default is StartsWith

    Returns
    Type Description
    IEnumerable<IMember>

    System.Collections.Generic.IEnumerable<T>

    View Source

    FindMembersByDisplayName(string, long, int, out long, StringPropertyMatchType)

    Finds Members based on their display name

    Declaration
    public IEnumerable<IMember> FindMembersByDisplayName(string displayNameToMatch, long pageIndex, int pageSize, out long totalRecords, StringPropertyMatchType matchType = StringPropertyMatchType.StartsWith)
    Parameters
    Type Name Description
    string displayNameToMatch

    Display name to match

    long pageIndex

    Current page index

    int pageSize

    Size of the page

    long totalRecords

    Total number of records found (out)

    StringPropertyMatchType matchType

    The type of match to make as StringPropertyMatchType. Default is StartsWith

    Returns
    Type Description
    IEnumerable<IMember>

    System.Collections.Generic.IEnumerable<T>

    View Source

    FindMembersInRole(string, string, StringPropertyMatchType)

    Declaration
    public IEnumerable<IMember> FindMembersInRole(string roleName, string usernameToMatch, StringPropertyMatchType matchType = StringPropertyMatchType.StartsWith)
    Parameters
    Type Name Description
    string roleName
    string usernameToMatch
    StringPropertyMatchType matchType
    Returns
    Type Description
    IEnumerable<IMember>
    View Source

    GetAll(int, int, out long, string, Direction, string?, string)

    Gets a list of paged IMember objects

    Declaration
    public IEnumerable<IMember> GetAll(int skip, int take, out long totalRecords, string orderBy, Direction orderDirection, string? memberTypeAlias = null, string filter = "")
    Parameters
    Type Name Description
    int skip

    Amount to skip.

    int take

    Amount to take.

    long totalRecords

    Total number of records found (out)

    string orderBy

    Field to order by

    Direction orderDirection

    Direction to order by

    string memberTypeAlias
    string filter

    Search text filter

    Returns
    Type Description
    IEnumerable<IMember>

    System.Collections.Generic.IEnumerable<T>

    Remarks

    An IMember can be of type IMember

    View Source

    GetAll(long, int, out long)

    Gets a list of paged IMember objects

    Declaration
    public IEnumerable<IMember> GetAll(long pageIndex, int pageSize, out long totalRecords)
    Parameters
    Type Name Description
    long pageIndex

    Current page index

    int pageSize

    Size of the page

    long totalRecords

    Total number of records found (out)

    Returns
    Type Description
    IEnumerable<IMember>

    System.Collections.Generic.IEnumerable<T>

    View Source

    GetAll(long, int, out long, string, Direction, bool, string?, string)

    Gets a list of paged IMember objects

    Declaration
    public IEnumerable<IMember> GetAll(long pageIndex, int pageSize, out long totalRecords, string orderBy, Direction orderDirection, bool orderBySystemField, string? memberTypeAlias, string filter)
    Parameters
    Type Name Description
    long pageIndex

    Current page index

    int pageSize

    Size of the page

    long totalRecords

    Total number of records found (out)

    string orderBy

    Field to order by

    Direction orderDirection

    Direction to order by

    bool orderBySystemField

    Flag to indicate when ordering by system field

    string memberTypeAlias
    string filter

    Search text filter

    Returns
    Type Description
    IEnumerable<IMember>

    System.Collections.Generic.IEnumerable<T>

    Remarks

    An IMember can be of type IMember

    View Source

    GetAllMembers(params int[])

    Gets all Members with the ids specified

    Declaration
    public IEnumerable<IMember> GetAllMembers(params int[] ids)
    Parameters
    Type Name Description
    int[] ids

    Optional list of Member Ids

    Returns
    Type Description
    IEnumerable<IMember>

    System.Collections.Generic.IEnumerable<T>

    Remarks

    If no Ids are specified all Members will be retrieved

    View Source

    GetAllRoles()

    Returns a list of all member roles

    Declaration
    public IEnumerable<IMemberGroup> GetAllRoles()
    Returns
    Type Description
    IEnumerable<IMemberGroup>

    A list of member roles

    View Source

    GetAllRoles(int)

    Returns a list of all member roles for a given member ID

    Declaration
    public IEnumerable<string> GetAllRoles(int memberId)
    Parameters
    Type Name Description
    int memberId
    Returns
    Type Description
    IEnumerable<string>

    A list of member roles

    View Source

    GetAllRoles(string)

    Declaration
    public IEnumerable<string> GetAllRoles(string username)
    Parameters
    Type Name Description
    string username
    Returns
    Type Description
    IEnumerable<string>
    View Source

    GetAllRolesIds()

    Declaration
    public IEnumerable<int> GetAllRolesIds()
    Returns
    Type Description
    IEnumerable<int>
    View Source

    GetAllRolesIds(int)

    Declaration
    public IEnumerable<int> GetAllRolesIds(int memberId)
    Parameters
    Type Name Description
    int memberId
    Returns
    Type Description
    IEnumerable<int>
    View Source

    GetAllRolesIds(string)

    Declaration
    public IEnumerable<int> GetAllRolesIds(string username)
    Parameters
    Type Name Description
    string username
    Returns
    Type Description
    IEnumerable<int>
    View Source

    GetByEmail(string)

    Get an IMember by email. If RequireUniqueEmailForMembers is set to false, then the first member found with the specified email will be returned.

    Declaration
    public IMember? GetByEmail(string email)
    Parameters
    Type Name Description
    string email

    Email to use for retrieval

    Returns
    Type Description
    IMember

    IMember

    View Source

    GetById(Guid)

    Gets a Member by the unique key

    Declaration
    public IMember? GetById(Guid id)
    Parameters
    Type Name Description
    Guid id

    System.Guid Id

    Returns
    Type Description
    IMember

    IMember

    Remarks

    The guid key corresponds to the unique id in the database and the user id in the membership provider.

    View Source

    GetById(int)

    Gets a Member by its integer id

    Declaration
    public IMember? GetById(int id)
    Parameters
    Type Name Description
    int id

    int Id

    Returns
    Type Description
    IMember

    IMember

    View Source

    GetByKeysAsync(params Guid[])

    Gets IMember objects by Ids

    Declaration
    public Task<IEnumerable<IMember>> GetByKeysAsync(params Guid[] ids)
    Parameters
    Type Name Description
    Guid[] ids

    Ids of the Member to retrieve

    Returns
    Type Description
    Task<IEnumerable<IMember>>

    IMember

    View Source

    GetByProviderKey(object)

    Gets an IMember by its provider key

    Declaration
    public IMember? GetByProviderKey(object id)
    Parameters
    Type Name Description
    object id

    Id to use for retrieval

    Returns
    Type Description
    IMember

    IMember

    View Source

    GetByUsername(string?)

    Get an IMember by username

    Declaration
    public IMember? GetByUsername(string? username)
    Parameters
    Type Name Description
    string username

    Username to use for retrieval

    Returns
    Type Description
    IMember

    IMember

    View Source

    GetCount(MemberCountType)

    Gets the total number of Members based on the count type

    Declaration
    public int GetCount(MemberCountType countType)
    Parameters
    Type Name Description
    MemberCountType countType

    MemberCountType to count by

    Returns
    Type Description
    int

    int with number of Members for passed in type

    Remarks

    The way the Online count is done is the same way that it is done in the MS SqlMembershipProvider - We query for any members that have their last active date within the Membership.UserIsOnlineTimeWindow (which is in minutes). It isn't exact science but that is how MS have made theirs so we'll follow that principal.

    View Source

    GetMembersByEmail(string)

    Get an list of IMember for all members with the specified email.

    Declaration
    public IEnumerable<IMember> GetMembersByEmail(string email)
    Parameters
    Type Name Description
    string email

    Email to use for retrieval

    Returns
    Type Description
    IEnumerable<IMember>

    System.Collections.Generic.IEnumerable<T>

    View Source

    GetMembersByGroup(string)

    Gets all Members within the specified MemberGroup name

    Declaration
    public IEnumerable<IMember> GetMembersByGroup(string memberGroupName)
    Parameters
    Type Name Description
    string memberGroupName

    Name of the MemberGroup

    Returns
    Type Description
    IEnumerable<IMember>

    System.Collections.Generic.IEnumerable<T>

    View Source

    GetMembersByMemberType(int)

    Gets all Members for the MemberType id

    Declaration
    public IEnumerable<IMember> GetMembersByMemberType(int memberTypeId)
    Parameters
    Type Name Description
    int memberTypeId

    Id of the MemberType

    Returns
    Type Description
    IEnumerable<IMember>

    System.Collections.Generic.IEnumerable<T>

    View Source

    GetMembersByMemberType(string)

    Gets all Members for the specified MemberType alias

    Declaration
    public IEnumerable<IMember> GetMembersByMemberType(string memberTypeAlias)
    Parameters
    Type Name Description
    string memberTypeAlias

    Alias of the MemberType

    Returns
    Type Description
    IEnumerable<IMember>

    System.Collections.Generic.IEnumerable<T>

    View Source

    GetMembersByPropertyValue(string, bool)

    Gets a list of Members based on a property search

    Declaration
    [Obsolete("Please use Search (Examine) instead, scheduled for removal in Umbraco 18.")]
    public IEnumerable<IMember> GetMembersByPropertyValue(string propertyTypeAlias, bool value)
    Parameters
    Type Name Description
    string propertyTypeAlias

    Alias of the PropertyType to search for

    bool value

    bool Value to match

    Returns
    Type Description
    IEnumerable<IMember>

    System.Collections.Generic.IEnumerable<T>

    Remarks

    Instead of using this method, which queries the database directly, we advise using search (Examine). You can configure an IValueSetValidator to ensure all the properties you need are indexed. https://docs.umbraco.com/umbraco-cms/reference/searching/examine/indexing#changing-ivaluesetvalidator

    View Source

    GetMembersByPropertyValue(string, DateTime, ValuePropertyMatchType)

    Gets a list of Members based on a property search

    Declaration
    [Obsolete("Please use Search (Examine) instead, scheduled for removal in Umbraco 18.")]
    public IEnumerable<IMember> GetMembersByPropertyValue(string propertyTypeAlias, DateTime value, ValuePropertyMatchType matchType = ValuePropertyMatchType.Exact)
    Parameters
    Type Name Description
    string propertyTypeAlias

    Alias of the PropertyType to search for

    DateTime value

    System.DateTime Value to match

    ValuePropertyMatchType matchType

    The type of match to make as StringPropertyMatchType. Default is Exact

    Returns
    Type Description
    IEnumerable<IMember>

    System.Collections.Generic.IEnumerable<T>

    Remarks

    Instead of using this method, which queries the database directly, we advise using search (Examine). You can configure an IValueSetValidator to ensure all the properties you need are indexed. https://docs.umbraco.com/umbraco-cms/reference/searching/examine/indexing#changing-ivaluesetvalidator

    View Source

    GetMembersByPropertyValue(string, int, ValuePropertyMatchType)

    Gets a list of Members based on a property search

    Declaration
    [Obsolete("Please use Search (Examine) instead, scheduled for removal in Umbraco 18.")]
    public IEnumerable<IMember> GetMembersByPropertyValue(string propertyTypeAlias, int value, ValuePropertyMatchType matchType = ValuePropertyMatchType.Exact)
    Parameters
    Type Name Description
    string propertyTypeAlias

    Alias of the PropertyType to search for

    int value

    int Value to match

    ValuePropertyMatchType matchType

    The type of match to make as StringPropertyMatchType. Default is Exact

    Returns
    Type Description
    IEnumerable<IMember>

    System.Collections.Generic.IEnumerable<T>

    Remarks

    Instead of using this method, which queries the database directly, we advise using search (Examine). You can configure an IValueSetValidator to ensure all the properties you need are indexed. https://docs.umbraco.com/umbraco-cms/reference/searching/examine/indexing#changing-ivaluesetvalidator

    View Source

    GetMembersByPropertyValue(string, string, StringPropertyMatchType)

    Gets a list of Members based on a property search

    Declaration
    [Obsolete("Please use Search (Examine) instead, scheduled for removal in Umbraco 18.")]
    public IEnumerable<IMember> GetMembersByPropertyValue(string propertyTypeAlias, string value, StringPropertyMatchType matchType = StringPropertyMatchType.Exact)
    Parameters
    Type Name Description
    string propertyTypeAlias

    Alias of the PropertyType to search for

    string value

    string Value to match

    StringPropertyMatchType matchType

    The type of match to make as StringPropertyMatchType. Default is Exact

    Returns
    Type Description
    IEnumerable<IMember>

    System.Collections.Generic.IEnumerable<T>

    Remarks

    Instead of using this method, which queries the database directly, we advise using search (Examine). You can configure an IValueSetValidator to ensure all the properties you need are indexed. https://docs.umbraco.com/umbraco-cms/reference/searching/examine/indexing#changing-ivaluesetvalidator

    View Source

    GetMembersInRole(string)

    Declaration
    public IEnumerable<IMember> GetMembersInRole(string roleName)
    Parameters
    Type Name Description
    string roleName
    Returns
    Type Description
    IEnumerable<IMember>
    View Source

    ReplaceRoles(int[], string[])

    Declaration
    public void ReplaceRoles(int[] memberIds, string[] roleNames)
    Parameters
    Type Name Description
    int[] memberIds
    string[] roleNames
    View Source

    ReplaceRoles(string[], string[])

    Declaration
    public void ReplaceRoles(string[] usernames, string[] roleNames)
    Parameters
    Type Name Description
    string[] usernames
    string[] roleNames
    View Source

    Save(IEnumerable<IMember>)

    Saves a list of IMembershipUser objects

    Declaration
    public void Save(IEnumerable<IMember> members)
    Parameters
    Type Name Description
    IEnumerable<IMember> members
    Remarks

    An IMembershipUser can be of type IMember or IUser

    View Source

    Save(IEnumerable<IMember>, int)

    Saves a list of IMember objects

    Declaration
    public Attempt<OperationResult?> Save(IEnumerable<IMember> members, int userId = -1)
    Parameters
    Type Name Description
    IEnumerable<IMember> members

    Collection of IMember to save

    int userId

    Id of the User saving the Members

    Returns
    Type Description
    Attempt<OperationResult>
    View Source

    Save(IMember)

    Saves an IMembershipUser

    Declaration
    public void Save(IMember member)
    Parameters
    Type Name Description
    IMember member
    Remarks

    An IMembershipUser can be of type IMember or IUser

    View Source

    Save(IMember, int)

    Saves a single IMember object

    Declaration
    public Attempt<OperationResult?> Save(IMember member, int userId = -1)
    Parameters
    Type Name Description
    IMember member
    int userId

    Id of the User saving the Member

    Returns
    Type Description
    Attempt<OperationResult>
    View Source

    Save(IMember, PublishNotificationSaveOptions, int)

    Saves an IMembershipUser

    Declaration
    public Attempt<OperationResult?> Save(IMember member, PublishNotificationSaveOptions publishNotificationSaveOptions, int userId = -1)
    Parameters
    Type Name Description
    IMember member

    IMember or IUser to Save

    PublishNotificationSaveOptions publishNotificationSaveOptions

    Enum for deciding which notifications to publish.

    int userId

    Id of the User saving the Member

    Returns
    Type Description
    Attempt<OperationResult>
    Remarks

    An IMembershipUser can be of type IMember or IUser

    View Source

    SetLastLogin(string, DateTime)

    Declaration
    public void SetLastLogin(string username, DateTime date)
    Parameters
    Type Name Description
    string username
    DateTime date
    View Source

    UpdateLoginPropertiesAsync(IMember)

    Saves only the properties related to login for the member, using an optimized, non-locking update.

    Declaration
    public Task UpdateLoginPropertiesAsync(IMember member)
    Parameters
    Type Name Description
    IMember member

    The member to update.

    Returns
    Type Description
    Task

    Used to avoid the full save of the member object after a login operation.

    Remarks

    Note that in this optimized member save operation for use in the login process, where we only handle login related properties, we aren't taking any locks. If we were updating "content" properties, that could have relations between each other, we should following what we do for documents and lock. But here we are just updating these system fields, and it's fine if they work in a "last one wins" fashion without locking.

    Note also that we aren't calling "Audit" here (as well as to optimize performance, this is deliberate, because this is not a full save operation on the member that we'd want to audit who made the changes via the backoffice or API; rather it's just the member logging in as themselves).

    We are though publishing notifications, to maintain backwards compatibility for any solutions using these for processing following a member login.

    These notification handlers will ensure that the records to umbracoLog are also added in the same way as they are for a full save operation.

    • Edit this page
    • View Source
    In this article
    Back to top Copyright © 2016-present Umbraco
    Generated by DocFX