コード例 #1
0
        public static void Serialize(IQueryPlanNode queryPlan, BinaryWriter writer)
        {
            var nodeType    = queryPlan.GetType();
            var seriializer = Resolver.ResolveSerializer(nodeType) as IObjectBinarySerializer;

            if (seriializer == null)
            {
                throw new InvalidOperationException(String.Format("Could not find any serializer for type '{0}'.", nodeType));
            }

            seriializer.Serialize(queryPlan, writer);
        }
コード例 #2
0
        public static void SerializeQueryPlan(this ISystemContext context, IQueryPlanNode node, BinaryWriter writer)
        {
            var nodeType = node.GetType();

            var serializers = context.ResolveAllServices<IQueryPlanNodeSerializer>();
            foreach (var serializer in serializers) {
                if (serializer.CanSerialize(nodeType)) {
                    serializer.Serialize(node, writer);
                    return;
                }
            }

            throw new InvalidOperationException(string.Format("Could not find any serializer for node type '{0}'.", nodeType));
        }
コード例 #3
0
        private static void WriteChildNode(BinaryWriter writer, IQueryPlanNode node)
        {
            if (node == null)
            {
                writer.Write((byte)0);
            }
            else
            {
                var nodeTypeString = node.GetType().FullName;
                writer.Write((byte)1);
                writer.Write(nodeTypeString);

                Serialize(node, writer);
            }
        }
コード例 #4
0
        public static void SerializeQueryPlan(this ISystemContext context, IQueryPlanNode node, BinaryWriter writer)
        {
            var nodeType = node.GetType();

            var serializers = context.ResolveAllServices <IQueryPlanNodeSerializer>();

            foreach (var serializer in serializers)
            {
                if (serializer.CanSerialize(nodeType))
                {
                    serializer.Serialize(node, writer);
                    return;
                }
            }

            throw new InvalidOperationException(string.Format("Could not find any serializer for node type '{0}'.", nodeType));
        }