public IBsonSerializer GetSerializer(Type type, Expression node)
        {
            Ensure.IsNotNull(type, nameof(type));

            IBsonSerializer serializer;

            if (node != null && PreviouslyUsedSerializerFinder.TryFindSerializer(node, type, out serializer))
            {
                return(serializer);
            }
            else if (node == null || type != node.Type)
            {
                return(_serializerRegistry.GetSerializer(type));
            }

            return(SerializerBuilder.Build(node, _serializerRegistry));
        }
Beispiel #2
0
 public static IBsonSerializer Build(Expression node, IBsonSerializerRegistry serializerRegistry)
 {
     var builder = new SerializerBuilder(serializerRegistry);
     return builder.Build(node);
 }
        public static IBsonSerializer Build(Expression node, IBsonSerializerRegistry serializerRegistry)
        {
            var builder = new SerializerBuilder(serializerRegistry);

            return(builder.Build(node));
        }