/// <summary> /// Converts a content node to Xml /// </summary> /// <param name="node"></param> /// <returns></returns> private static XDocument ToXDocument(Content node) { if (TypeHelper.IsTypeAssignableFrom <Document>(node)) { return(new XDocument(((Document)node).ContentEntity.ToXml())); } if (TypeHelper.IsTypeAssignableFrom <global::umbraco.cms.businesslogic.media.Media>(node)) { return(new XDocument(((global::umbraco.cms.businesslogic.media.Media)node).MediaItem.ToXml())); } var xDoc = new XmlDocument(); var xNode = xDoc.CreateNode(XmlNodeType.Element, "node", ""); node.XmlPopulate(xDoc, ref xNode, false); if (xNode.Attributes["nodeTypeAlias"] == null) { //we'll add the nodeTypeAlias ourselves XmlAttribute d = xDoc.CreateAttribute("nodeTypeAlias"); d.Value = node.ContentType.Alias; xNode.Attributes.Append(d); } return(new XDocument(ExamineXmlExtensions.ToXElement(xNode))); }
private static void MemberAfterSave(Member sender, SaveEventArgs e) { //ensure that only the providers are flagged to listen execute var xml = ExamineXmlExtensions.ToXElement(sender.ToXml(new System.Xml.XmlDocument(), false)); var providers = ExamineManager.Instance.IndexProviderCollection.OfType <BaseUmbracoIndexer>() .Where(x => x.EnableDefaultEventHandler); ExamineManager.Instance.ReIndexNode(xml, IndexTypes.Member, providers); }