Interface IMemberService
Defines the MemberService, which is an easy access to operations involving (umbraco) members.
Namespace:System.Dynamic.ExpandoObject
Assembly:Umbraco.Core.dll
Syntax
public interface IMemberService : IMembershipMemberService, IMembershipMemberService<IMember>, IService, IMembershipRoleService<IMember>
Methods
Count(String)
Gets the count of Members by an optional MemberType alias
Declaration
int Count(string memberTypeAlias = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | memberTypeAlias | Optional alias for the MemberType when counting number of Members |
Returns
Type | Description |
---|---|
System.Int32 |
Remarks
If no alias is supplied then the count for all Member will be returned
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 |
---|---|---|
System.String | username | Username of the Member to create |
System.String | Email of the Member to create |
|
System.String | name | Name of the Member to create |
System.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.
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 |
---|---|---|
System.String | username | Username of the Member to create |
System.String | Email of the Member to create |
|
System.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.
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 |
---|---|---|
System.String | username | Username of the Member to create |
System.String | Email of the Member to create |
|
System.String | name | Name of the Member to create |
System.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)
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 |
---|---|---|
System.String | username | Username of the Member to create |
System.String | Email of the Member to create |
|
System.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)
DeleteMembersOfType(Int32)
Delete Members of the specified MemberType id
Declaration
void DeleteMembersOfType(int memberTypeId)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | memberTypeId | Id of the MemberType |
Exists(Int32)
Checks if a Member with the id exists
Declaration
bool Exists(int id)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | id | Id of the Member |
Returns
Type | Description |
---|---|
System.Boolean |
|
FindMembersByDisplayName(String, Int32, Int32, out Int32, StringPropertyMatchType)
Declaration
[Obsolete("Use the overload with 'long' parameter types instead")]
IEnumerable<IMember> FindMembersByDisplayName(string displayNameToMatch, int pageIndex, int pageSize, out int totalRecords, StringPropertyMatchType matchType = StringPropertyMatchType.StartsWith)
Parameters
Type | Name | Description |
---|---|---|
System.String | displayNameToMatch | |
System.Int32 | pageIndex | |
System.Int32 | pageSize | |
System.Int32 | totalRecords | |
StringPropertyMatchType | matchType |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<IMember> |
FindMembersByDisplayName(String, Int64, Int32, out Int64, 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 |
---|---|---|
System.String | displayNameToMatch | Display name to match |
System.Int64 | pageIndex | Current page index |
System.Int32 | pageSize | Size of the page |
System.Int64 | totalRecords | Total number of records found (out) |
StringPropertyMatchType | matchType | The type of match to make as StringPropertyMatchType. Default is StartsWith |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<IMember> | System.Collections.Generic.IEnumerable<T> |
GetAll(Int32, Int32, out Int32, String, Direction, String, String)
Declaration
[Obsolete("Use the overload with 'long' parameter types instead")]
IEnumerable<IMember> GetAll(int pageIndex, int pageSize, out int totalRecords, string orderBy, Direction orderDirection, string memberTypeAlias = null, string filter = "")
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | pageIndex | |
System.Int32 | pageSize | |
System.Int32 | totalRecords | |
System.String | orderBy | |
Direction | orderDirection | |
System.String | memberTypeAlias | |
System.String | filter |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<IMember> |
GetAll(Int64, Int32, out Int64, String, Direction, Boolean, 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 |
---|---|---|
System.Int64 | pageIndex | Current page index |
System.Int32 | pageSize | Size of the page |
System.Int64 | totalRecords | Total number of records found (out) |
System.String | orderBy | Field to order by |
Direction | orderDirection | Direction to order by |
System.Boolean | orderBySystemField | Flag to indicate when ordering by system field |
System.String | memberTypeAlias | |
System.String | filter | Search text filter |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<IMember> | System.Collections.Generic.IEnumerable<T> |
Remarks
GetAll(Int64, Int32, out Int64, String, Direction, String, String)
Gets a list of paged IMember objects
Declaration
IEnumerable<IMember> GetAll(long pageIndex, int pageSize, out long totalRecords, string orderBy, Direction orderDirection, string memberTypeAlias = null, string filter = "")
Parameters
Type | Name | Description |
---|---|---|
System.Int64 | pageIndex | Current page index |
System.Int32 | pageSize | Size of the page |
System.Int64 | totalRecords | Total number of records found (out) |
System.String | orderBy | Field to order by |
Direction | orderDirection | Direction to order by |
System.String | memberTypeAlias | |
System.String | filter | Search text filter |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<IMember> | System.Collections.Generic.IEnumerable<T> |
Remarks
GetAllMembers(Int32[])
Gets all Members with the ids specified
Declaration
IEnumerable<IMember> GetAllMembers(params int[] ids)
Parameters
Type | Name | Description |
---|---|---|
System.Int32[] | ids | Optional list of Member Ids |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<IMember> | System.Collections.Generic.IEnumerable<T> |
Remarks
If no Ids are specified all Members will be retrieved
GetById(Int32)
Gets a Member by its integer id
Declaration
IMember GetById(int id)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | id |
Returns
Type | Description |
---|---|
IMember | IMember |
GetByKey(Guid)
Gets a Member by the unique key
Declaration
IMember GetByKey(Guid id)
Parameters
Type | Name | Description |
---|---|---|
System.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.
GetMembersByGroup(String)
Gets all Members within the specified MemberGroup name
Declaration
IEnumerable<IMember> GetMembersByGroup(string memberGroupName)
Parameters
Type | Name | Description |
---|---|---|
System.String | memberGroupName | Name of the MemberGroup |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<IMember> | System.Collections.Generic.IEnumerable<T> |
GetMembersByMemberType(Int32)
Gets all Members for the MemberType id
Declaration
IEnumerable<IMember> GetMembersByMemberType(int memberTypeId)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | memberTypeId | Id of the MemberType |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<IMember> | System.Collections.Generic.IEnumerable<T> |
GetMembersByMemberType(String)
Gets all Members for the specified MemberType alias
Declaration
IEnumerable<IMember> GetMembersByMemberType(string memberTypeAlias)
Parameters
Type | Name | Description |
---|---|---|
System.String | memberTypeAlias | Alias of the MemberType |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<IMember> | System.Collections.Generic.IEnumerable<T> |
GetMembersByPropertyValue(String, Boolean)
Gets a list of Members based on a property search
Declaration
IEnumerable<IMember> GetMembersByPropertyValue(string propertyTypeAlias, bool value)
Parameters
Type | Name | Description |
---|---|---|
System.String | propertyTypeAlias | Alias of the PropertyType to search for |
System.Boolean | value |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<IMember> | System.Collections.Generic.IEnumerable<T> |
GetMembersByPropertyValue(String, DateTime, ValuePropertyMatchType)
Gets a list of Members based on a property search
Declaration
IEnumerable<IMember> GetMembersByPropertyValue(string propertyTypeAlias, DateTime value, ValuePropertyMatchType matchType = ValuePropertyMatchType.Exact)
Parameters
Type | Name | Description |
---|---|---|
System.String | propertyTypeAlias | Alias of the PropertyType to search for |
System.DateTime | value | System.DateTime Value to match |
ValuePropertyMatchType | matchType | The type of match to make as StringPropertyMatchType. Default is Exact |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<IMember> | System.Collections.Generic.IEnumerable<T> |
GetMembersByPropertyValue(String, Int32, ValuePropertyMatchType)
Gets a list of Members based on a property search
Declaration
IEnumerable<IMember> GetMembersByPropertyValue(string propertyTypeAlias, int value, ValuePropertyMatchType matchType = ValuePropertyMatchType.Exact)
Parameters
Type | Name | Description |
---|---|---|
System.String | propertyTypeAlias | Alias of the PropertyType to search for |
System.Int32 | value | |
ValuePropertyMatchType | matchType | The type of match to make as StringPropertyMatchType. Default is Exact |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<IMember> | System.Collections.Generic.IEnumerable<T> |
GetMembersByPropertyValue(String, String, StringPropertyMatchType)
Gets a list of Members based on a property search
Declaration
IEnumerable<IMember> GetMembersByPropertyValue(string propertyTypeAlias, string value, StringPropertyMatchType matchType = StringPropertyMatchType.Exact)
Parameters
Type | Name | Description |
---|---|---|
System.String | propertyTypeAlias | Alias of the PropertyType to search for |
System.String | value | |
StringPropertyMatchType | matchType | The type of match to make as StringPropertyMatchType. Default is Exact |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<IMember> | System.Collections.Generic.IEnumerable<T> |
GetPagedXmlEntries(Int64, Int32, out Int64)
Gets all XML entries found in the cmsContentXml table
Declaration
IEnumerable<XElement> GetPagedXmlEntries(long pageIndex, int pageSize, out long totalRecords)
Parameters
Type | Name | Description |
---|---|---|
System.Int64 | pageIndex | Page number |
System.Int32 | pageSize | Page size |
System.Int64 | totalRecords | Total records the query would return without paging |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<System.Xml.Linq.XElement> | A paged enumerable of XML entries of content items |
RebuildXmlStructures(Int32[])
Rebuilds all xml content in the cmsContentXml table for all documents
Declaration
void RebuildXmlStructures(params int[] contentTypeIds)
Parameters
Type | Name | Description |
---|---|---|
System.Int32[] | contentTypeIds | Only rebuild the xml structures for the content type ids passed in, if none then rebuilds the structures for all content |
SavePassword(IMember, String)
This is simply a helper method which essentially just wraps the MembershipProvider's ChangePassword method which can be used during Member creation.
Declaration
void SavePassword(IMember member, string password)
Parameters
Type | Name | Description |
---|---|---|
IMember | member | The Member to save the password for |
System.String | password | The password to encrypt and save |
Remarks
This method exists so that Umbraco developers can use this entry point to set a password when Creating members ... this will not work for updating members in most cases (depends on your membership provider settings)
It is preferred to use the membership APIs for working with passwords, in the near future this method will be obsoleted and the ASP.NET Identity APIs should be used instead.