/// <summary> /// Converts the given value to the ATOM string representation /// and uses the writer to write it. /// </summary> /// <param name="writer">The writer to write the stringified value.</param> /// <param name="value">The value to be written.</param> internal static void WritePrimitiveValue(XmlWriter writer, object value) { Debug.Assert(value != null, "value != null"); if (!PrimitiveConverter.Instance.TryWriteAtom(value, writer)) { string result = ConvertPrimitiveToString(value); ODataAtomWriterUtils.WriteString(writer, result); } }
internal static void WritePrimitiveValue(XmlWriter writer, object value) { if (!PrimitiveConverter.Instance.TryWriteAtom(value, writer)) { string str; if (!TryConvertPrimitiveToString(value, out str)) { throw new ODataException(Microsoft.Data.OData.Strings.AtomValueUtils_CannotConvertValueToAtomPrimitive(value.GetType().FullName)); } ODataAtomWriterUtils.WriteString(writer, str); } }
/// <summary> /// Converts the given value to the ATOM string representation /// and uses the writer to write it. /// </summary> /// <param name="writer">The writer to write the stringified value.</param> /// <param name="value">The value to be written.</param> internal static void WritePrimitiveValue(XmlWriter writer, object value) { DebugUtils.CheckNoExternalCallers(); Debug.Assert(value != null, "value != null"); if (!PrimitiveConverter.Instance.TryWriteAtom(value, writer)) { string result; if (!TryConvertPrimitiveToString(value, out result)) { throw new ODataException(Strings.AtomValueUtils_CannotConvertValueToAtomPrimitive(value.GetType().FullName)); } ODataAtomWriterUtils.WriteString(writer, result); } }