When I'm iterating through members I'm using the uQuery extension "GetMembersByXPath(string xpath)" from uComponents. This loads the members from the XML cache instead of loading them from the database by calling Member.GetAll. Should increase performance a lot by doing it this way :-)
How to populate all Members with Profile properties?
HI, Im trying to populate all members with profile properties, athough I have successfully done this but It's loading too slow.
public static XPathNodeIterator GetAllMembers()
{
XmlDocument membersXML = new XmlDocument();
membersXML.LoadXml("<members></members>");
try
{
//For each member in a specific member group
foreach (Member memb in Member.GetAll)
{
//The current member object - get the XML
//New XMLNode for <member>
XmlNode membNode = membersXML.CreateElement("member");
//memberID attribute
XmlAttribute membAttrID = membersXML.CreateAttribute("memberID");
membAttrID.Value = memb.Id.ToString();
membNode.Attributes.Append(membAttrID);
foreach (Property prop in memb.getProperties)
{
//Property node
XmlNode propNode = membersXML.CreateElement(prop.PropertyType.Alias);
//Set the value
propNode.InnerText = prop.Value.ToString();
//Append Property node to member node
membNode.AppendChild(propNode);
}
//Append to <members> root node
membersXML.SelectSingleNode("/members").AppendChild(membNode);
}
return membersXML.CreateNavigator().Select("//members");
}
catch (Exception ex)
{
membersXML.LoadXml("<response><success>false</success><error>" + ex.Message.ToString() + "</error></response>");
return membersXML.CreateNavigator().Select("/response");
}
}
Hi Jeffrey,
When I'm iterating through members I'm using the uQuery extension "GetMembersByXPath(string xpath)" from uComponents. This loads the members from the XML cache instead of loading them from the database by calling Member.GetAll. Should increase performance a lot by doing it this way :-)
Grab uComponents here: uComponents
The reference you need are uComponents.Core and you're good to go!
The XPath code would then look something like this:
Where "members" is your collection of members that you can loop through.
Let me know if there's any hold-ups :-)
All the best,
Bo
is working on a reply...