/// <summary> /// Tries the get serialization information. /// </summary> /// <param name="node">The node.</param> /// <param name="serializationInfoCache">The serialization information cache.</param> /// <param name="serializationInfo">The serialization information.</param> /// <returns></returns> public static bool TryGetSerializationInfo(Expression node, Dictionary <Expression, BsonSerializationInfo> serializationInfoCache, out BsonSerializationInfo serializationInfo) { var finder = new BsonSerializationInfoFinder(serializationInfoCache); serializationInfo = finder.Visit(node); return(serializationInfo != null); }
// public static methods /// <summary> /// Gets the serialization info for the node utilizing precalculated serialization information. /// </summary> /// <param name="node">The expression.</param> /// <param name="serializationInfoCache">The serialization info cache.</param> /// <returns>BsonSerializationInfo for the expression.</returns> public static BsonSerializationInfo GetSerializationInfo(Expression node, Dictionary <Expression, BsonSerializationInfo> serializationInfoCache) { var finder = new BsonSerializationInfoFinder(serializationInfoCache); var serializationInfo = finder.Visit(node); if (serializationInfo == null) { string message = string.Format("Unable to determine the serialization information for the expression: {0}.", ExpressionFormatter.ToString(node)); throw new NotSupportedException(message); } return(serializationInfo); }
// public methods /// <summary> /// Gets the serialization info for the given expression. /// </summary> /// <param name="node">The expression.</param> /// <returns>The serialization info.</returns> public BsonSerializationInfo GetSerializationInfo(Expression node) { var evaluatedNode = PartialEvaluator.Evaluate(node); return(BsonSerializationInfoFinder.GetSerializationInfo(evaluatedNode, _serializationInfoCache)); }
/// <summary> /// Tries the get serialization information. /// </summary> /// <param name="node">The node.</param> /// <param name="serializationInfo">The serialization information.</param> /// <returns></returns> public bool TryGetSerializationInfo(Expression node, out BsonSerializationInfo serializationInfo) { var evaluatedNode = PartialEvaluator.Evaluate(node); return(BsonSerializationInfoFinder.TryGetSerializationInfo(evaluatedNode, _serializationInfoCache, out serializationInfo)); }
// public methods /// <summary> /// Gets the serialization info for the given expression. /// </summary> /// <param name="node">The expression.</param> /// <returns>The serialization info.</returns> public BsonSerializationInfo GetSerializationInfo(Expression node) { return(BsonSerializationInfoFinder.GetSerializationInfo(node, _serializationInfoCache)); }