internal void WriteTo(string name, string ns, XmlWriter writer, string xmlNamespace)
{
if (string.IsNullOrEmpty(name))
{
name = ResourceName;
}
if (!string.IsNullOrEmpty(Namespace))
{
ns = Namespace;
}
writer.WriteStartElement(name, ns);
if (Key != null) writer.WriteAttributeString("key", xmlNamespace, Key);
if (Uri != null) writer.WriteAttributeString("uri", xmlNamespace, Uri.AbsoluteUri);
if (Uuid != null) writer.WriteAttributeString("uuid", xmlNamespace, Uuid.ToString());
if (Descriptor != null) writer.WriteAttributeString("descriptor", xmlNamespace, Descriptor);
if (Lookup != null) writer.WriteAttributeString("lookup", xmlNamespace, Lookup);
if (IsDeleted != null) writer.WriteAttributeString("isDeleted", xmlNamespace, XmlConvert.ToString(IsDeleted.Value));
foreach (var pair in Values)
{
WriteItemTo(pair.Key, ns, pair.Value, writer, xmlNamespace);
}
writer.WriteEndElement();
}