示例#1
0
        /// <summary>
        /// Serializes an expression to a string
        /// </summary>
        /// <param name='context'>Data context used to generate type names for types.</param>
        /// <param name="e">Expression to serialize</param>
        /// <param name='inPath'>Whether or not the expression being written is part of the path of the URI.</param>
        /// <param name="uriVersion">the request data service version for the uri</param>
        /// <returns>serialized expression</returns>
        internal static string ExpressionToString(DataServiceContext context, Expression e, bool inPath, ref Version uriVersion)
        {
            ExpressionWriter ew         = new ExpressionWriter(context, inPath);
            string           serialized = ew.Translate(e);

            WebUtil.RaiseVersion(ref uriVersion, ew.uriVersion);
            if (ew.cantTranslateExpression)
            {
                throw new NotSupportedException(Strings.ALinq_CantTranslateExpression(e.ToString()));
            }

            return(serialized);
        }
示例#2
0
 /// <summary>Serializes an expression to a string.</summary>
 /// <param name="expression">Expression to serialize</param>
 /// <param name='inPath'>Whether or not the expression being written is part of the path of the URI.</param>
 /// <returns>The serialized expression.</returns>
 private string ExpressionToString(Expression expression, bool inPath)
 {
     return(ExpressionWriter.ExpressionToString(this.context, expression, inPath, ref this.uriVersion));
 }
示例#3
0
        /// <summary>
        /// Serializes an expression to a string
        /// </summary>
        /// <param name='context'>Data context used to generate type names for types.</param>
        /// <param name="e">Expression to serialize</param>
        /// <param name='inPath'>Whether or not the expression being written is part of the path of the URI.</param>
        /// <param name="uriVersion">the request data service version for the uri</param>
        /// <returns>serialized expression</returns>
        internal static string ExpressionToString(DataServiceContext context, Expression e, bool inPath, ref Version uriVersion)
        {
            ExpressionWriter ew = new ExpressionWriter(context, inPath);
            string serialized = ew.Translate(e);
            WebUtil.RaiseVersion(ref uriVersion, ew.uriVersion);
            if (ew.cantTranslateExpression)
            {
                throw new NotSupportedException(Strings.ALinq_CantTranslateExpression(e.ToString()));
            }

            return serialized;
        }