Esempio n. 1
0
        /// <summary>
        /// Gets an expression for a value by first converting it with a specific type converter and then calling Serialize.  This
        /// method can be called directly when using a Property Converter
        /// </summary>
        /// <param name="value">the value to generate an expression for</param>
        /// <param name="converter">the type converter to use for conversion</param>
        /// <param name="currentPath">the current path to the value</param>
        /// <param name="serializer">serializer instance</param>
        /// <returns>an expression for the value</returns>
        public Expression GetExpression(object value, IJsonTypeConverter converter, JsonPath currentPath, ISerializerHandler serializer)
        {
            object convertedObject = converter.ConvertFrom(value, Context);
            // call serialize again in case the new type has a converter
            Expression expr = serializer.Serialize(convertedObject, currentPath, null);

            serializer.SetCanReference(value);   // can't reference inside the object
            return(expr);
        }
        /// <summary>
        /// Gets an expression for a value by first converting it with a specific type converter and then calling Serialize.  This
        /// method can be called directly when using a Property Converter
        /// </summary>
        /// <param name="value">the value to generate an expression for</param>
        /// <param name="converter">the type converter to use for conversion</param>
        /// <param name="currentPath">the current path to the value</param>
        /// <param name="serializer">serializer instance</param>
        /// <returns>an expression for the value</returns>
        public Expression GetExpression(object value, IJsonTypeConverter converter, JsonPath currentPath, IExpressionBuilder serializer)
        {
            //TODO: Cast for now to avoid breaking compatibility
            object convertedObject = converter.ConvertFrom(value, (SerializerSettings)Settings);
            // call serialize again in case the new type has a converter
            Expression expr = serializer.Serialize(convertedObject, currentPath, null);

            serializer.SetCanReference(value);   // can't reference inside the object
            return(expr);
        }
 /// <summary>
 /// Gets an expression for a value by first converting it with a specific type converter and then calling Serialize.  This
 /// method can be called directly when using a Property Converter
 /// </summary>
 /// <param name="value">the value to generate an expression for</param>
 /// <param name="converter">the type converter to use for conversion</param>
 /// <param name="currentPath">the current path to the value</param>
 /// <param name="serializer">serializer instance</param>
 /// <returns>an expression for the value</returns>
 public Expression GetExpression(object value, IJsonTypeConverter converter, JsonPath currentPath, ISerializerHandler serializer)
 {
     object convertedObject = converter.ConvertFrom(value, Context);
     // call serialize again in case the new type has a converter
     Expression expr = serializer.Serialize(convertedObject, currentPath, null);
     serializer.SetCanReference(value);   // can't reference inside the object
     return expr;
 }
 /// <summary>
 /// Gets an expression for a value by first converting it with a specific type converter and then calling Serialize.  This
 /// method can be called directly when using a Property Converter
 /// </summary>
 /// <param name="value">the value to generate an expression for</param>
 /// <param name="converter">the type converter to use for conversion</param>
 /// <param name="currentPath">the current path to the value</param>
 /// <param name="serializer">serializer instance</param>
 /// <returns>an expression for the value</returns>
 public Expression GetExpression(object value, IJsonTypeConverter converter, JsonPath currentPath, IExpressionBuilder serializer)
 {
     //TODO: Cast for now to avoid breaking compatibility
     object convertedObject = converter.ConvertFrom(value, (SerializationContext) Config);
     // call serialize again in case the new type has a converter
     Expression expr = serializer.Serialize(convertedObject, currentPath, null);
     serializer.SetCanReference(value);   // can't reference inside the object
     return expr;
 }