public static string GetXmlRootSignature(XmlRootAttribute root) { var sb = new StringBuilder(); XmlAttributeOverridesThumbprinter.AddXmlRootPrint(root, sb); return(sb.ToString()); }
public static string GetOverridesSignature(XmlAttributeOverrides overrides) { // GetHashCode looks at something other than the content // of XmlOverrideAttributes and comes up with different // hash values for two instances that would produce // the same XML is the were applied to the XmlSerializer. // Therefore I need to do something more intelligent // to normalize the content of XmlAttributeOverrides // or extract a thumbpront that only accounts for the // attributes in XmlAttributeOverrides. // The main problems is that // I can only access the hashtables that store the // overriding attributes through reflection, i.e. // I can't run the XmlSerializerCache in a partially // trusted security context. // // Also, the extra computation to create a purely // content-based thumbprint not offset the savings. // // If none if these were an issue I'd simply say: // return overrides.GetHashCode().ToString(); string thumbPrint = null; if (null != overrides) { thumbPrint = XmlAttributeOverridesThumbprinter.GetThumbprint(overrides); } return(thumbPrint); }