internal override void Store(Element element, object serialized, object source, TypeCache typeCache, Cache cache) { if (source == null || serialized == null) return; // Replace the element content in the database with the new content using (TextReader textReader = new StringReader((string)serialized)) { using(XmlReader reader = XmlReader.Create(textReader)) { // Move to the root element reader.MoveToContent(); // Replace all attributes element.RemoveAllAttributes(); if(reader.HasAttributes) { while(reader.MoveToNextAttribute()) { element.InsertAttribute(reader.Name, reader.Value); } reader.MoveToElement(); } // Replace the child content // Need to use an intermediate string since there is no way to // get the "inner XML" of an XmlReader without getting the // parent element too element.InnerXml = reader.ReadInnerXml(); } } }