コード例 #1
0
ファイル: EpmWriterUtils.cs プロジェクト: modulexcite/pash-1
        internal static string GetPropertyValueAsText(object propertyValue)
        {
            string str;

            if (propertyValue == null)
            {
                return(null);
            }
            if (!AtomValueUtils.TryConvertPrimitiveToString(propertyValue, out str))
            {
                throw new ODataException(Microsoft.Data.OData.Strings.AtomValueUtils_CannotConvertValueToAtomPrimitive(propertyValue.GetType().FullName));
            }
            return(str);
        }
コード例 #2
0
        /// <summary>
        /// Given a property value returns the text value to be used in EPM.
        /// </summary>
        /// <param name="propertyValue">The value of the property.</param>
        /// <returns>The text representation of the value, or the method throws if the text representation was not possible to obtain.</returns>
        internal static string GetPropertyValueAsText(object propertyValue)
        {
            DebugUtils.CheckNoExternalCallers();

            if (propertyValue == null)
            {
                return(null);
            }

            string textPropertyValue;

            if (!AtomValueUtils.TryConvertPrimitiveToString(propertyValue, out textPropertyValue))
            {
                throw new ODataException(Strings.AtomValueUtils_CannotConvertValueToAtomPrimitive(propertyValue.GetType().FullName));
            }

            return(textPropertyValue);
        }