Search Results for

    Show / Hide Table of Contents
    View Source

    Interface IMemberService

    Defines the MemberService, which is an easy access to operations involving (umbraco) members.

    Namespace: Umbraco.Cms.Core.Services
    Assembly: Umbraco.Core.dll
    Syntax
    public interface IMemberService : IMembershipMemberService, IMembershipMemberService<IMember>, IMembershipRoleService<IMember>, IContentServiceBase<IMember>, IContentServiceBase, IService

    Methods

    View Source

    Count(string?)

    Gets the count of Members by an optional MemberType alias

    Declaration
    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
    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.

    View Source

    CreateMember(string, string, string, IMemberType)

    Creates an IMember object without persisting it

    Declaration
    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
    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
    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
    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
    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, IMemberType)

    Creates and persists a Member

    Declaration
    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

    Delete(IMember, int)

    Permanently deletes an IMember object

    Declaration
    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
    void DeleteMembersOfType(int memberTypeId)
    Parameters
    Type Name Description
    int memberTypeId

    Id of the MemberType

    View Source

    Exists(int)

    Checks if a Member with the id exists

    Declaration
    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

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

    Declaration
    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

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

    Finds Members based on their display name

    Declaration
    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

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

    Gets a list of paged IMember objects

    Declaration
    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, string, Direction, bool, string?, string)

    Gets a list of paged IMember objects

    Declaration
    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
    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

    GetById(int)

    Gets a Member by its integer id

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

    int Id

    Returns
    Type Description
    IMember

    IMember

    View Source

    GetByKey(Guid)

    Gets a Member by the unique key

    Declaration
    [Obsolete("Use GetById. Scheduled for removal in Umbraco 18.")]
    IMember? GetByKey(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

    GetByKeysAsync(params Guid[])

    Gets IMember objects by Ids

    Declaration
    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

    GetMembersByEmail(string)

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

    Declaration
    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
    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
    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
    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.")]
    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.")]
    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.")]
    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.")]
    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

    Save(IEnumerable<IMember>, int)

    Saves a list of IMember objects

    Declaration
    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, int)

    Saves a single IMember object

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

    The IMember to save

    int userId

    Id of the User saving the Member

    Returns
    Type Description
    Attempt<OperationResult>
    View Source

    Save(IMember, PublishNotificationSaveOptions, int)

    Saves an IMembershipUser

    Declaration
    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

    UpdateLoginPropertiesAsync(IMember)

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

    Declaration
    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.

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