I want to get all members of from the umbraco members section that as a generic property set to a certain value. My current approach looks something like this:
var members = (from member in umbraco.cms.businesslogic.member.Member.GetAllAsList() where member.getProperty("yada").Value.ToString() == yada.ToString() select member);
I know that this will force that code to load all members into memory which is not a good idea. How would you solve this problem without talking directly to the database? Is that possible?
Indexing the members in Lucene would be the fastest option, but there's also a helper method in uQuery to get members by an XPath expression (which internally does one DB hit) - would expect that to be quicker than instantiating every member object.
I'll have a look at the Lucene-solution and uQuery (qhich is great stuff!). My approach since I posted this was create my own "MemberExtended" class that inherits Member, and add method that doese almost the same thing as the "GetUsersAsList"-method. Not ideal, but i works and is very fast.
Filter members based on a generic propery
Hi!
I want to get all members of from the umbraco members section that as a generic property set to a certain value. My current approach looks something like this:
var members = (from member in umbraco.cms.businesslogic.member.Member.GetAllAsList()
where member.getProperty("yada").Value.ToString() == yada.ToString()
select member);
I know that this will force that code to load all members into memory which is not a good idea. How would you solve this problem without talking directly to the database? Is that possible?
Hi. Afaik, there's no such API to do what youu want besides going to the DB directly (what isn't a good idea I think).
Perhaps a solution could be to make Examine index properties you need and getting them by an Examine query straight from the index.
Hi Markus,
Indexing the members in Lucene would be the fastest option, but there's also a helper method in uQuery to get members by an XPath expression (which internally does one DB hit) - would expect that to be quicker than instantiating every member object.
HTH,
Hendy
Thanks alot for the feedback!
I'll have a look at the Lucene-solution and uQuery (qhich is great stuff!). My approach since I posted this was create my own "MemberExtended" class that inherits Member, and add method that doese almost the same thing as the "GetUsersAsList"-method. Not ideal, but i works and is very fast.
is working on a reply...