/// <summary> /// Serialize a ConflictDetailsProperties instance /// </summary> /// <param name="objectToSerialize"></param> /// <returns></returns> public static string Serialize( ConflictDetailsProperties objectToSerialize) { DataContractSerializer serializer = new DataContractSerializer(typeof(ConflictDetailsProperties)); using (MemoryStream memStrm = new MemoryStream()) { serializer.WriteObject(memStrm, objectToSerialize); memStrm.Seek(0, SeekOrigin.Begin); using (StreamReader sw = new StreamReader(memStrm)) { return(sw.ReadToEnd()); } } }
/// <summary> /// Try translating the raw string conflict details to the Conflict Details Property Bag. This may /// fail if the details are old free-style conflict details. /// </summary> /// <param name="dtls">The conflict details to be translated.</param> /// <param name="conflictDetailsProperty">The output conflict details</param> /// <returns>TRUE if the details are translated to the conflict details property bag; otherwise, FALSE.</returns> public bool TryTranslateConflictDetailsToNamedProperties(string dtls, out ConflictDetailsProperties conflictDetailsProperty) { conflictDetailsProperty = null; bool retVal = false; try { conflictDetailsProperty = ConflictDetailsProperties.Deserialize(dtls); retVal = true; } catch (Exception e) { // trace the exception, eat it, and we will return null TraceManager.TraceException(e); } return(retVal); }